public class IO extends Object
Constructor and Description |
---|
IO() |
Modifier and Type | Method and Description |
---|---|
static void |
copy(InputStream is,
OutputStream os)
Copy an stream to another one.
|
static void |
copyDirectory(File source,
File target) |
static byte[] |
readContent(File file)
Read binary content of a file (warning does not use on large file !)
|
static byte[] |
readContent(InputStream is)
Read binary content of a stream (warning does not use on large file !)
|
static String |
readContentAsString(File file)
Read file content to a String (always use utf-8)
|
static String |
readContentAsString(File file,
String encoding)
Read file content to a String
|
static String |
readContentAsString(InputStream is)
Read the Stream content as a string (use utf-8)
|
static String |
readContentAsString(InputStream is,
String encoding)
Read the Stream content as a string
|
static List<String> |
readLines(File file) |
static List<String> |
readLines(File file,
String encoding) |
static List<String> |
readLines(InputStream is) |
static Properties |
readUtf8Properties(InputStream is)
Read a properties file with the utf-8 encoding
|
static void |
write(byte[] data,
File file)
Write binary data to a file
|
static void |
write(InputStream is,
File f)
Copy an stream to another one.
|
static void |
write(InputStream is,
OutputStream os)
Copy an stream to another one.
|
static void |
writeContent(CharSequence content,
File file)
Write String content to a file (always use utf-8)
|
static void |
writeContent(CharSequence content,
File file,
String encoding)
Write String content to a file (always use utf-8)
|
static void |
writeContent(CharSequence content,
OutputStream os)
Write String content to a stream (always use utf-8)
|
static void |
writeContent(CharSequence content,
OutputStream os,
String encoding)
Write String content to a stream (always use utf-8)
|
public static Properties readUtf8Properties(InputStream is)
is
- Stream to properties filepublic static String readContentAsString(InputStream is)
is
- The stream to readpublic static String readContentAsString(InputStream is, String encoding)
is
- The stream to readpublic static String readContentAsString(File file)
file
- The file to readpublic static String readContentAsString(File file, String encoding)
file
- The file to readpublic static List<String> readLines(InputStream is)
public static byte[] readContent(File file)
file
- The file te readpublic static byte[] readContent(InputStream is)
is
- The stream to readpublic static void writeContent(CharSequence content, OutputStream os)
content
- The content to writeos
- The stream to writepublic static void writeContent(CharSequence content, OutputStream os, String encoding)
content
- The content to writeos
- The stream to writepublic static void writeContent(CharSequence content, File file)
content
- The content to writefile
- The file to writepublic static void writeContent(CharSequence content, File file, String encoding)
content
- The content to writefile
- The file to writepublic static void write(byte[] data, File file)
data
- The binary data to writefile
- The file to writepublic static void copy(InputStream is, OutputStream os)
public static void write(InputStream is, OutputStream os)
public static void write(InputStream is, File f)
Guillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly