public class IOUtils extends Object
Modifier and Type | Field and Description |
---|---|
static int |
BUFFER_SIZE
Default buffer size for stream utility methods
|
Constructor and Description |
---|
IOUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
closeStream(Closeable obj) |
static boolean |
closeStream(InputStream in) |
static boolean |
closeStream(OutputStream out) |
static void |
copy(InputStream in,
OutputStream out)
Copy from an input stream to an output stream.
|
static void |
copy(InputStream in,
OutputStream out,
long count)
Copy the specified number of bytes from an input stream to an output
stream.
|
static void |
copy(InputStream in,
OutputStream out,
long count,
int bufferSize)
Copy the specified number of bytes from an input stream to an output
stream.
|
static void |
copyFile(File from,
File to) |
static boolean |
delTree(File file) |
static Long |
fromByteSize(String val) |
static String |
getFilenameExtension(String filename) |
static String |
getFilenameWithoutExtension(String filename) |
static boolean |
isNull(Object obj) |
static String |
readStringFromFile(File file,
String charset) |
static String |
readStringFromStream(InputStream in,
String charset) |
static String |
readUTF8StringFromFile(File file) |
static String |
readUTF8StringFromStream(InputStream in) |
static int |
readyFully(InputStream in,
byte[] buf) |
static void |
recurseDeleteDirectory(File dir) |
static void |
rollover(File logFile,
int maxFiles) |
static byte[] |
sha1Digest(File file) |
static byte[] |
sha1Digest(InputStream in) |
static String |
toByteSize(double t) |
static String |
toByteSize(double t,
int decimalPlaces) |
static InputStream |
toInputStream(String value,
String charset) |
static void |
writeStringToFile(File file,
String string,
String charset) |
static void |
writeStringToStream(OutputStream out,
String string,
String charset) |
static void |
writeUTF8StringToFile(File file,
String string) |
static void |
writeUTF8StringToStream(OutputStream out,
String string) |
public static int BUFFER_SIZE
public static void copy(InputStream in, OutputStream out) throws IOException
in
- input streamout
- output streamIOException
- on any errorpublic static void copy(InputStream in, OutputStream out, long count) throws IOException
in
- input streamout
- output streamcount
- number of bytes to copyIOException
- on any errorpublic static void copy(InputStream in, OutputStream out, long count, int bufferSize) throws IOException
in
- input streamout
- output streamcount
- number of bytes to copybufferSize
- buffer sizeIOException
- on any errorpublic static boolean closeStream(InputStream in)
in
- public static boolean closeStream(OutputStream out)
out
- public static boolean delTree(File file)
public static void recurseDeleteDirectory(File dir)
public static void copyFile(File from, File to) throws IOException
IOException
public static int readyFully(InputStream in, byte[] buf) throws IOException
IOException
public static void writeUTF8StringToStream(OutputStream out, String string) throws UnsupportedEncodingException, IOException
public static void writeStringToStream(OutputStream out, String string, String charset) throws UnsupportedEncodingException, IOException
public static void writeUTF8StringToFile(File file, String string) throws UnsupportedEncodingException, IOException
public static void writeStringToFile(File file, String string, String charset) throws UnsupportedEncodingException, IOException
public static String toByteSize(double t)
public static String toByteSize(double t, int decimalPlaces)
public static byte[] sha1Digest(File file) throws NoSuchAlgorithmException, FileNotFoundException, IOException
public static byte[] sha1Digest(InputStream in) throws NoSuchAlgorithmException, IOException
NoSuchAlgorithmException
IOException
public static void closeStream(Closeable obj)
public static boolean isNull(Object obj)
public static void rollover(File logFile, int maxFiles)
public static String readUTF8StringFromFile(File file) throws IOException
IOException
public static String readUTF8StringFromStream(InputStream in) throws IOException
IOException
public static String readStringFromFile(File file, String charset) throws UnsupportedEncodingException, IOException
public static String readStringFromStream(InputStream in, String charset) throws IOException
IOException
public static InputStream toInputStream(String value, String charset) throws IOException
IOException
Copyright © 2024. All rights reserved.