public class IOUtil extends Object
Modifier and Type | Field and Description |
---|---|
static int |
BUFFER_SIZE
Default buffer size for stream utility methods
|
Constructor and Description |
---|
IOUtil() |
Modifier and Type | Method and Description |
---|---|
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 int |
readyFully(InputStream in,
byte[] buf) |
static void |
recurseDeleteDirectory(File dir) |
static String |
toByteSize(double t) |
static String |
toByteSize(double t,
int decimalPlaces) |
static InputStream |
toInputStream(String str,
String charset) |
static String |
toString(InputStream in,
String charset) |
static String |
toUTF8String(InputStream in) |
static void |
writeBytesToFile(byte[] value,
File file) |
static void |
writeStringToFile(File file,
String string,
String charset) |
static void |
writeStringToStream(OutputStream out,
String string,
String charset) |
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 writeStringToStream(OutputStream out, String string, String charset) throws UnsupportedEncodingException, IOException
public static void writeStringToFile(File file, String string, String charset) throws UnsupportedEncodingException, IOException
public static InputStream toInputStream(String str, String charset) throws IOException
IOException
public static String toUTF8String(InputStream in) throws IOException
IOException
public static String toString(InputStream in, String charset) throws IOException
IOException
public static void writeBytesToFile(byte[] value, File file) throws IOException
IOException
public static String toByteSize(double t)
public static String toByteSize(double t, int decimalPlaces)
Copyright © 2024. All rights reserved.