org.jtool.jxplatform.io
Class FileReader

java.lang.Object
  extended byorg.jtool.jxplatform.io.FileReader

public class FileReader
extends java.lang.Object

Reads characters from a file.

Author:
Katsuhisa Maruyama

Constructor Summary
FileReader()
           
 
Method Summary
static java.lang.String read(java.io.File file)
          Reads characters and returns its text.
static java.lang.String read(java.io.File file, java.lang.String charsetName)
          Reads characters and returns its text.
static java.lang.String read(java.lang.String name)
          Reads characters and returns its text.
static java.lang.String read(java.lang.String name, java.lang.String charsetName)
          Reads characters and returns its text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileReader

public FileReader()
Method Detail

read

public static java.lang.String read(java.lang.String name)
                             throws java.io.FileNotFoundException,
                                    java.io.IOException
Reads characters and returns its text.

Parameters:
name - The name of a file to read from.
Returns:
The text of the read file.
Throws:
java.io.FileNotFoundException - If the file did not exist or could not be opened for reading.
java.io.IOException - If an I/O error occurred.

read

public static java.lang.String read(java.lang.String name,
                                    java.lang.String charsetName)
                             throws java.io.FileNotFoundException,
                                    java.io.UnsupportedEncodingException,
                                    java.io.IOException
Reads characters and returns its text.

Parameters:
name - The name of a file to read from.
charsetName - The name of a charset.
Returns:
The text of the read file.
Throws:
java.io.FileNotFoundException - If the file did not exist or could not be opened for reading.
java.io.UnsupportedEncodingException - If the charset is not supported.
java.io.IOException - If an I/O error occurred.

read

public static java.lang.String read(java.io.File file)
                             throws java.io.FileNotFoundException,
                                    java.io.IOException
Reads characters and returns its text.

Parameters:
file - A file to read from.
Returns:
The text of the read file.
Throws:
java.io.FileNotFoundException - If the file did not exist or could not be opened for reading.
java.io.IOException - If an I/O error occurred.

read

public static java.lang.String read(java.io.File file,
                                    java.lang.String charsetName)
                             throws java.io.FileNotFoundException,
                                    java.io.UnsupportedEncodingException,
                                    java.io.IOException
Reads characters and returns its text.

Parameters:
file - A file to read from.
charsetName - The name of a charset.
Returns:
The text of the read file.
Throws:
java.io.FileNotFoundException - If the file did not exist or could not be opened for reading.
java.io.UnsupportedEncodingException - If the charset is not supported.
java.io.IOException - If an I/O error occurred.