com.jfw.file
Class ReadFile

java.lang.Object
  extended by com.jfw.file.ReadFile

public final class ReadFile
extends java.lang.Object

Read a file.


Constructor Summary
ReadFile(java.lang.String readThisFile)
          Create an instance.
ReadFile(java.lang.String path, java.lang.String readThisFile)
          Create an instance.
 
Method Summary
 java.lang.String getFileToRead()
          Get fileToRead attribute.
 void readAndWriteBinaryFile(java.io.OutputStream outputStream)
          Deprecated. use FileUtils.readAndWriteBinaryFile(com.jfw.file.ReadFile, java.io.OutputStream, com.jfw.util.Encryption).
 byte[] readBinaryFile()
          Get the content of the file.
 java.lang.String readTextFile()
          Get the content of the file.
 void setTextEncode(java.lang.String encodeType)
          Set attribute encodeType.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReadFile

public ReadFile(java.lang.String readThisFile)
Create an instance.

Parameters:
readThisFile - file to read, with absolute path.

ReadFile

public ReadFile(java.lang.String path,
                java.lang.String readThisFile)
Create an instance.

Parameters:
path - path of file to read.
readThisFile - file name.
Method Detail

getFileToRead

public java.lang.String getFileToRead()
Get fileToRead attribute.

Returns:
fileToRead.

setTextEncode

public void setTextEncode(java.lang.String encodeType)
Set attribute encodeType. Encode must be set before call the method readTextFile().

Parameters:
encodeType - the encode to use.

readTextFile

public java.lang.String readTextFile()
                              throws JFWGenericException
Get the content of the file.

Returns:
a String with the content of the file.
Throws:
JFWGenericException

readBinaryFile

public byte[] readBinaryFile()
                      throws JFWGenericException
Get the content of the file.

Returns:
a byte[] with the content of the file.
Throws:
JFWGenericException

readAndWriteBinaryFile

public void readAndWriteBinaryFile(java.io.OutputStream outputStream)
                            throws JFWGenericException
Deprecated. use FileUtils.readAndWriteBinaryFile(com.jfw.file.ReadFile, java.io.OutputStream, com.jfw.util.Encryption).

Read the file set in constructor and write it in the stream defined as parameter.
The output stream are not closed by that method.

Parameters:
outputStream - the stream to write the readed file.
Throws:
JFWGenericException