Package play.libs
Class IO
- java.lang.Object
-
- play.libs.IO
-
public class IO extends java.lang.ObjectIO utils
-
-
Constructor Summary
Constructors Constructor Description IO()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcopy(java.io.InputStream is, java.io.OutputStream os)Copy an stream to another one.static voidcopyDirectory(java.io.File source, java.io.File target)static byte[]readContent(java.io.File file)Read binary content of a file (warning does not use on large file !)static byte[]readContent(java.io.InputStream is)Read binary content of a stream (warning does not use on large file !)static java.lang.StringreadContentAsString(java.io.File file)Read file content to a String (always use utf-8)static java.lang.StringreadContentAsString(java.io.File file, java.lang.String encoding)Read file content to a Stringstatic java.lang.StringreadContentAsString(java.io.InputStream is)Read the Stream content as a string (use utf-8)static java.lang.StringreadContentAsString(java.io.InputStream is, java.lang.String encoding)Read the Stream content as a stringstatic java.util.List<java.lang.String>readLines(java.io.File file)static java.util.List<java.lang.String>readLines(java.io.File file, java.lang.String encoding)static java.util.List<java.lang.String>readLines(java.io.InputStream is)static java.util.PropertiesreadUtf8Properties(java.io.InputStream is)Read a properties file with the utf-8 encodingstatic voidwrite(byte[] data, java.io.File file)Write binary data to a filestatic voidwrite(java.io.InputStream is, java.io.File f)Copy an stream to another one.static voidwrite(java.io.InputStream is, java.io.OutputStream os)Copy an stream to another one.static voidwriteContent(java.lang.CharSequence content, java.io.File file)Write String content to a file (always use utf-8)static voidwriteContent(java.lang.CharSequence content, java.io.File file, java.lang.String encoding)Write String content to a file (always use utf-8)static voidwriteContent(java.lang.CharSequence content, java.io.OutputStream os)Write String content to a stream (always use utf-8)static voidwriteContent(java.lang.CharSequence content, java.io.OutputStream os, java.lang.String encoding)Write String content to a stream (always use utf-8)
-
-
-
Method Detail
-
readUtf8Properties
public static java.util.Properties readUtf8Properties(java.io.InputStream is)
Read a properties file with the utf-8 encoding- Parameters:
is- Stream to properties file- Returns:
- The Properties object
-
readContentAsString
public static java.lang.String readContentAsString(java.io.InputStream is)
Read the Stream content as a string (use utf-8)- Parameters:
is- The stream to read- Returns:
- The String content
-
readContentAsString
public static java.lang.String readContentAsString(java.io.InputStream is, java.lang.String encoding)Read the Stream content as a string- Parameters:
is- The stream to readencoding- Encoding to used- Returns:
- The String content
-
readContentAsString
public static java.lang.String readContentAsString(java.io.File file)
Read file content to a String (always use utf-8)- Parameters:
file- The file to read- Returns:
- The String content
-
readContentAsString
public static java.lang.String readContentAsString(java.io.File file, java.lang.String encoding)Read file content to a String- Parameters:
file- The file to readencoding- Encoding to used- Returns:
- The String content
-
readLines
public static java.util.List<java.lang.String> readLines(java.io.InputStream is)
-
readLines
public static java.util.List<java.lang.String> readLines(java.io.File file, java.lang.String encoding)
-
readLines
public static java.util.List<java.lang.String> readLines(java.io.File file)
-
readContent
public static byte[] readContent(java.io.File file)
Read binary content of a file (warning does not use on large file !)- Parameters:
file- The file te read- Returns:
- The binary data
-
readContent
public static byte[] readContent(java.io.InputStream is)
Read binary content of a stream (warning does not use on large file !)- Parameters:
is- The stream to read- Returns:
- The binary data
-
writeContent
public static void writeContent(java.lang.CharSequence content, java.io.OutputStream os)Write String content to a stream (always use utf-8)- Parameters:
content- The content to writeos- The stream to write
-
writeContent
public static void writeContent(java.lang.CharSequence content, java.io.OutputStream os, java.lang.String encoding)Write String content to a stream (always use utf-8)- Parameters:
content- The content to writeos- The stream to writeencoding- Encoding to used
-
writeContent
public static void writeContent(java.lang.CharSequence content, java.io.File file)Write String content to a file (always use utf-8)- Parameters:
content- The content to writefile- The file to write
-
writeContent
public static void writeContent(java.lang.CharSequence content, java.io.File file, java.lang.String encoding)Write String content to a file (always use utf-8)- Parameters:
content- The content to writefile- The file to writeencoding- Encoding to used
-
write
public static void write(byte[] data, java.io.File file)Write binary data to a file- Parameters:
data- The binary data to writefile- The file to write
-
copy
public static void copy(java.io.InputStream is, java.io.OutputStream os)Copy an stream to another one.- Parameters:
is- The source streamos- The destination stream
-
write
public static void write(java.io.InputStream is, java.io.OutputStream os)Copy an stream to another one.- Parameters:
is- The source streamos- The destination stream
-
write
public static void write(java.io.InputStream is, java.io.File f)Copy an stream to another one.- Parameters:
is- The source streamf- The destination file
-
copyDirectory
public static void copyDirectory(java.io.File source, java.io.File target)
-
-