|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.Writer
java.io.OutputStreamWriter
java.io.FileWriter
j2ee.io.FileWriter
public class FileWriter
Extention of the java.io.FileWriter that enables users of the J2EEPS to write their files to their user area at the DFS filesystem at CERN.
By instantiating a FileWriter with a j2ee.io.File, writing to the file and eventually calling the flush method of this class, the file will be saved back to DFS if there is valid location information available as described for the j2ee.io.File class
It is worth noting that this class will overwrite already existing files at DFS if the normal constructor is used, so be careful if you don't want to delete your data unintentially
Field Summary | |
---|---|
private java.io.File |
file
|
private org.apache.commons.httpclient.HttpsURL |
hrl
|
private java.lang.String |
location
|
private java.lang.String |
password
|
private java.lang.String |
username
|
Fields inherited from class java.io.Writer |
---|
lock |
Constructor Summary | |
---|---|
FileWriter(File file)
Standard constructor that creates the FileWriter from the input file |
|
FileWriter(File file,
boolean append)
Constructs a FileWriter object given a File object. |
|
FileWriter(java.lang.String fileName)
Constructs a FileWriter object given a file name. |
|
FileWriter(java.lang.String fileName,
boolean append)
Constructs a FileWriter object given a file name with a boolean indicating whether or not to append the data written. |
Method Summary | |
---|---|
void |
flush()
This method flushes the data written to the file first locally, and then, if DFS location information is available and valid, it saves the data to DFS |
private boolean |
getLocationInfo()
Checks if it can find a dfs.properties file in the user's directory. |
private java.lang.String |
parseLocation(java.lang.String s)
Helper method that ensures that the input does not start or end with a "/". |
private void |
save()
Method that actually saves the file to the location at DFS. |
boolean |
setDFSConnection(java.lang.String location)
This method sets the DFS connection according to the specified input. |
Methods inherited from class java.io.OutputStreamWriter |
---|
close, getEncoding, write, write, write |
Methods inherited from class java.io.Writer |
---|
append, append, append, write, write |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.lang.String location
private java.lang.String username
private java.lang.String password
private java.io.File file
private org.apache.commons.httpclient.HttpsURL hrl
Constructor Detail |
---|
public FileWriter(File file) throws java.io.IOException
Standard constructor that creates the FileWriter from the input file
file
- - The file to be written to
java.io.IOException
public FileWriter(File file, boolean append) throws java.io.IOException
Constructs a FileWriter object given a File object. If the second argument is true, then bytes will be written to the end of the file rather than the beginning.
file
- - The file to be written toappend
- - if true, the bytes will be written to the end of the file rather than the beginning
java.io.IOException
public FileWriter(java.lang.String fileName) throws java.io.IOException
Constructs a FileWriter object given a file name.
param fileName - The filename to write to
java.io.IOException
public FileWriter(java.lang.String fileName, boolean append) throws java.io.IOException
Constructs a FileWriter object given a file name with a boolean indicating whether or not to append the data written.
fileName
- - The filename to write toappend
- - f true, then data will be written to the end of the file rather than the beginning.
java.io.IOException
Method Detail |
---|
private void save()
Method that actually saves the file to the location at DFS. It is used by the flush method
public void flush() throws java.io.IOException
This method flushes the data written to the file first locally, and then, if DFS location information is available and valid, it saves the data to DFS
flush
in interface java.io.Flushable
flush
in class java.io.OutputStreamWriter
java.io.IOException
public boolean setDFSConnection(java.lang.String location)
This method sets the DFS connection according to the specified input. It does not check if this is a valid location, that has to be done after by trying to create the WebdavResource connection
location
- - the DFS location
private java.lang.String parseLocation(java.lang.String s)
Helper method that ensures that the input does not start or end with a "/". Is used to ensure conformity when treating location strings in the class
s
- - The string to be checked for starting or ending "/"'s
private boolean getLocationInfo()
Checks if it can find a dfs.properties file in the user's directory.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |