|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object
|
+--java.io.OutputStream
|
+--org.openorb.util.DiffFileOutputStream
Non-clobbering file output stream. This behaves similarly to the standard java.io.FileOutputStream, however if the file already exists it will not touch the file unless the data being written is different to the current file contents. Note that care must be taken to always close the output stream, if this does not occour and the class is not garbage collected it can leave data from the old file at the end of the new file.
| Constructor Summary | |
DiffFileOutputStream(File file)
Construct a new diff output stream |
|
DiffFileOutputStream(String filename)
Construct a new diff output stream |
|
| Method Summary | |
void |
close()
Closes the output stream and releases any system resources associated with this stream. |
static boolean |
copyFileNoClobber(File src,
File dest)
Perform a non-clobbering copy. |
static boolean |
copyFileNoClobber(String src,
String dest)
Perform a non-clobbering copy. |
boolean |
isWriting()
Returns true if the output stream is now in write mode, and the file is being overwritten. |
static void |
main(String[] args)
|
void |
write(byte[] b,
int off,
int len)
Writes len bytes from the specified byte array
starting at offset off to this file output stream. |
void |
write(int b)
Writes the specified byte to this output stream. |
| Methods inherited from class java.io.OutputStream |
flush, write |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public DiffFileOutputStream(File file)
throws FileNotFoundException
file - the file to be written to.FileNotFoundException - if the file exists but is a directory
rather than a regular file, does not exist but cannot be created,
or cannot be opened for any other reason.
public DiffFileOutputStream(String filename)
throws FileNotFoundException
filename - the name of the file.FileNotFoundException - if the file exists but is a directory
rather than a regular file, does not exist but cannot be created,
or cannot be opened for any other reason.| Method Detail |
public static boolean copyFileNoClobber(File src,
File dest)
throws IOException
src - the source file.dest - the destination file.IOException - if an IOException occours.
public static boolean copyFileNoClobber(String src,
String dest)
throws IOException
src - the source file.dest - the destination file.IOException - if an IOException occours.public boolean isWriting()
public void write(int b)
throws IOException
write is that one byte is written
to the output stream. The byte to be written is the eight
low-order bits of the argument b. The 24
high-order bits of b are ignored.
Subclasses of OutputStream must provide an
implementation for this method.
write in class OutputStreamb - the byte.IOException - if an I/O error occurs. In particular,
an IOException may be thrown if the
output stream has been closed.
public void write(byte[] b,
int off,
int len)
throws IOException
len bytes from the specified byte array
starting at offset off to this file output stream.write in class OutputStreamb - the data.off - the start offset in the data.len - the number of bytes to write.IOException - if an I/O error occurs.
public void close()
throws IOException
close in class OutputStreamIOException - if an I/O error occurs.
public static void main(String[] args)
throws IOException
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||