com.jfw.file
Class SaveFile

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

public final class SaveFile
extends java.lang.Object

Save a file.


Constructor Summary
SaveFile(java.lang.String fileName)
          Create an instance.
SaveFile(java.lang.String path, java.lang.String fileName)
          Create an instance.
 
Method Summary
 void backupBinaryFile()
          Create a backup copy of the file with extension returned by method.
 void backupTextFile()
          Create a backup copy of the file with extension returned by method.
 void close()
          Close streams used for saving the file.
 void finalize()
          Call super and method close().
 boolean isIsAppend()
          Get append behaviour.
 void saveBinaryFile(byte[] fileContent)
          Save binary file.
 void saveTextFile(java.lang.String fileContent)
          Save text file.
 void setIsAppend(boolean isAppend)
          Set append behaviour.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SaveFile

public SaveFile(java.lang.String fileName)
Create an instance.

Parameters:
fileName - the name of the file with absolute path.

SaveFile

public SaveFile(java.lang.String path,
                java.lang.String fileName)
Create an instance. If the path not exist will create now.

Parameters:
path - the path of the saved file.
fileName - the file name.
Method Detail

saveTextFile

public void saveTextFile(java.lang.String fileContent)
                  throws JFWGenericException
Save text file.

Parameters:
fileContent - the content of the file.
Throws:
JFWGenericException

saveBinaryFile

public void saveBinaryFile(byte[] fileContent)
                    throws JFWGenericException
Save binary file.

Parameters:
fileContent - the content of the file.
Throws:
JFWGenericException

isIsAppend

public boolean isIsAppend()
Get append behaviour.

Returns:
true if append is set, false in other case.

setIsAppend

public void setIsAppend(boolean isAppend)
Set append behaviour.

Parameters:
isAppend - true to set append behaviour, false in other case.

backupTextFile

public void backupTextFile()
                    throws JFWGenericException
Create a backup copy of the file with extension returned by method. Miscellaneous.getTimeExtension().

Throws:
JFWGenericException

backupBinaryFile

public void backupBinaryFile()
                      throws JFWGenericException
Create a backup copy of the file with extension returned by method. Miscellaneous.getTimeExtension().

Throws:
JFWGenericException

close

public void close()
Close streams used for saving the file.


finalize

public void finalize()
              throws java.lang.Throwable
Call super and method close().

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable