play.libs
Class IO

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

public class IO
extends java.lang.Object

IO utils


Constructor Summary
IO()
           
 
Method Summary
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.String readContentAsString(java.io.File file)
          Read file content to a String (always use utf-8)
static java.lang.String readContentAsString(java.io.InputStream is)
          Read the Stream conten as a string (always use utf-8)
static java.util.Properties readUtf8Properties(java.io.InputStream is)
          Read a properties file with the utf-8 encoding
static void write(byte[] data, java.io.File file)
          Write binay data to a file
static void write(java.io.InputStream is, java.io.OutputStream os)
          Copy an stream to another one.
static void writeContent(java.lang.CharSequence content, java.io.File file)
          Write String content to a file (always use utf-8)
static void writeContent(java.lang.CharSequence content, java.io.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 java.util.Properties readUtf8Properties(java.io.InputStream is)
                                               throws java.io.IOException
Read a properties file with the utf-8 encoding

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

readContentAsString

public static java.lang.String readContentAsString(java.io.InputStream is)
                                            throws java.io.IOException
Read the Stream conten as a string (always use utf-8)

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

readContentAsString

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

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

readContent

public static byte[] readContent(java.io.File file)
                          throws java.io.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:
java.io.IOException

readContent

public static byte[] readContent(java.io.InputStream is)
                          throws java.io.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:
java.io.IOException

writeContent

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

Parameters:
content - The content to write
os - The stream to write
Throws:
java.io.IOException

writeContent

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

Parameters:
content - The content to write
file - The file to write
Throws:
java.io.IOException

write

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

Parameters:
data - The binary data to write
file - The file to write
Throws:
java.io.IOException

write

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

Throws:
java.io.IOException


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