public class IOUtils extends Object
| Constructor and Description |
|---|
IOUtils() |
| Modifier and Type | Method and Description |
|---|---|
static long |
copy(InputStream from,
OutputStream to)
Copies one stream to another using 4K buffer.
|
static String |
getFileExtension(String path)
Gets file extension.
|
static String |
read(InputStream from,
Charset charset)
Reads stream to string.
|
static byte[] |
readFile(File file)
Reads file content.
|
static void |
writeFile(byte[] content,
File file)
Writes content to file.
|
public static long copy(InputStream from, OutputStream to) throws IOException
from - stream to copy fromto - stream to copy toIOExceptionpublic static String read(InputStream from, Charset charset) throws IOException
from - stream to read fromcharset - charset to be used for encodingIOExceptionpublic static byte[] readFile(File file) throws IOException
file - path to file to read fromIOExceptionpublic static void writeFile(byte[] content,
File file)
throws IOException
content - data to writefile - file to write toIOException