de.goerntkai.toolbox.fs
Class TextReader

java.lang.Object
  extended byde.goerntkai.toolbox.fs.TextReader

public abstract class TextReader
extends java.lang.Object

Reads a complete text file and returns the whole document.

Version:
$Id: TextReader.java,v 1.5 2007/05/06 16:25:52 GoerntKai Exp $
Author:
Kai Görnt

Method Summary
static java.lang.StringBuffer getTextDocument(java.io.File documentFile)
          This method uses java.io.FileReader to get the content of the document file.
static java.lang.StringBuffer getTextDocument(java.lang.String documentFile)
          This method just calls getTextDocument(java.io.File) to get the content of the document file.
static java.lang.String[] getTextLines(java.io.File theFile)
          Reads the file and stores every line in an array.
static java.lang.String[] getTextLines(java.lang.String theFile)
          Reads the file and stores every line in an array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getTextDocument

public static java.lang.StringBuffer getTextDocument(java.io.File documentFile)
                                              throws java.io.FileNotFoundException

This method uses java.io.FileReader to get the content of the document file. The file comes in byte by byte.

Parameters:
documentFile - the file to read
Returns:
the whole text document
Throws:
java.io.FileNotFoundException - if the file does not exist or is no file

getTextDocument

public static java.lang.StringBuffer getTextDocument(java.lang.String documentFile)
                                              throws java.io.FileNotFoundException

This method just calls getTextDocument(java.io.File) to get the content of the document file.

Parameters:
documentFile - the name of the file to read
Returns:
the whole text document
Throws:
java.io.FileNotFoundException - if the file does not exist or is no file
See Also:
getTextDocument(File)

getTextLines

public static java.lang.String[] getTextLines(java.io.File theFile)
                                       throws java.io.FileNotFoundException

Reads the file and stores every line in an array.

Precondition:
theFile != null

Parameters:
theFile - the file to read
Returns:
an array of lines
Throws:
java.io.FileNotFoundException - if the file does not exist or is no file

getTextLines

public static java.lang.String[] getTextLines(java.lang.String theFile)
                                       throws java.io.FileNotFoundException

Reads the file and stores every line in an array.

Precondition:
theFile != null

Parameters:
theFile - the file to read
Returns:
an array of lines
Throws:
java.io.FileNotFoundException - if the file does not exist or is no file


Copyright © 2004-2007 Kai Görnt. All Rights Reserved.