|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
java.io.FileOutputStream
j2ee.io.FileOutputStream
public class FileOutputStream
Extention of the java.io.FileOutputStream that enables users of the J2EEPS to write their files to their user area at the DFS filesystem at CERN.
By instantiating a FileOutputStream 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 boolean |
overWrite
|
private java.lang.String |
password
|
private java.lang.String |
username
|
Constructor Summary | |
---|---|
FileOutputStream(File file)
Standard constructor that creates the FileOutputStream from the input file |
|
FileOutputStream(File file,
boolean append)
Constructs a FileOutputStream object given a File object. |
|
FileOutputStream(java.lang.String name)
Constructs a FileOtputStream object given a file name. |
|
FileOutputStream(java.lang.String name,
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.FileOutputStream |
---|
close, finalize, getChannel, getFD, write, write, write |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.io.File file
private boolean overWrite
private java.lang.String location
private java.lang.String username
private java.lang.String password
private org.apache.commons.httpclient.HttpsURL hrl
Constructor Detail |
---|
public FileOutputStream(File file) throws java.io.FileNotFoundException
Standard constructor that creates the FileOutputStream from the input file
file
- - The file to be written to
java.io.FileNotFoundException
public FileOutputStream(File file, boolean append) throws java.io.FileNotFoundException
Constructs a FileOutputStream 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.FileNotFoundException
public FileOutputStream(java.lang.String name) throws java.io.FileNotFoundException
Constructs a FileOtputStream object given a file name.
name
- - The filename to write to
java.io.FileNotFoundException
public FileOutputStream(java.lang.String name, boolean append) throws java.io.FileNotFoundException
Constructs a FileWriter object given a file name with a boolean indicating whether or not to append the data written.
name
- - The filename to write toappend
- - f true, then data will be written to the end of the file rather than the beginning.
java.io.FileNotFoundException
Method Detail |
---|
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.OutputStream
java.io.IOException
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.
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 void save()
Method that actually saves the file to the location at DFS. It is used by the flush method
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |