play.libs
Class IO

java.lang.Object
  extended by play.libs.IO

public class IO
extends Object

IO utils


Constructor Summary
IO()
           
 
Method Summary
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(InputStream is)
          Read the Stream content as a string (always use utf-8)
static Properties readUtf8Properties(InputStream is)
          Read a properties file with the utf-8 encoding
static void write(byte[] data, File file)
          Write binay data to a file
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, OutputStream os)
          Write String content to a stream (always use utf-8)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IO

public IO()
Method Detail

readUtf8Properties

public static Properties readUtf8Properties(InputStream is)
                                     throws IOException
Read a properties file with the utf-8 encoding

Parameters:
is - Stream to properties file
Returns:
The Properties object
Throws:
IOException

readContentAsString

public static String readContentAsString(InputStream is)
                                  throws IOException
Read the Stream content as a string (always use utf-8)

Parameters:
is - The stream to read
Returns:
The String content
Throws:
IOException

readContentAsString

public static String readContentAsString(File file)
                                  throws IOException
Read file content to a String (always use utf-8)

Parameters:
file - The file to read
Returns:
The String content
Throws:
IOException

readContent

public static byte[] readContent(File file)
                          throws IOException
Read binary content of a file (warning does not use on large file !)

Parameters:
file - The file te read
Returns:
The binary data
Throws:
IOException

readContent

public static byte[] readContent(InputStream is)
                          throws IOException
Read binary content of a stream (warning does not use on large file !)

Parameters:
is - The stream to read
Returns:
The binary data
Throws:
IOException

writeContent

public static void writeContent(CharSequence content,
                                OutputStream os)
                         throws IOException
Write String content to a stream (always use utf-8)

Parameters:
content - The content to write
os - The stream to write
Throws:
IOException

writeContent

public static void writeContent(CharSequence content,
                                File file)
                         throws IOException
Write String content to a file (always use utf-8)

Parameters:
content - The content to write
file - The file to write
Throws:
IOException

write

public static void write(byte[] data,
                         File file)
                  throws IOException
Write binay data to a file

Parameters:
data - The binary data to write
file - The file to write
Throws:
IOException

write

public static void write(InputStream is,
                         OutputStream os)
                  throws IOException
Copy an stream to another one.

Throws:
IOException


Guillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly