org.eclipse.osgi.framework.internal.reliablefile
Class ReliableFileOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by org.eclipse.osgi.framework.internal.reliablefile.ReliableFileOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

public class ReliableFileOutputStream
extends java.io.FilterOutputStream

A ReliableFile FileOutputStream replacement class. This class can be used just like FileOutputStream. The class is in partnership with ReliableFileInputStream to avoid losing file data by using multiple files.

See Also:
ReliableFileInputStream

Field Summary
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
ReliableFileOutputStream(java.io.File file)
          Constructs a new ReliableFileOutputStream on the File file.
ReliableFileOutputStream(java.io.File file, boolean append)
          Constructs a new ReliableFileOutputStream on the File file.
ReliableFileOutputStream(java.lang.String name)
          Constructs a new ReliableFileOutputStream on the file named name.
ReliableFileOutputStream(java.lang.String name, boolean append)
          Constructs a new ReliableFileOutputStream on the file named name.
 
Method Summary
 void abort()
           
 void close()
          Closes this output stream and releases any system resources associated with this stream.
 java.io.File closeIntermediateFile()
           
 void write(byte[] b)
          Override default FilterOutputStream method.
 void write(byte[] b, int off, int len)
          Override default FilterOutputStream method.
 void write(int b)
          Override default FilterOutputStream method.
 
Methods inherited from class java.io.FilterOutputStream
flush
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReliableFileOutputStream

public ReliableFileOutputStream(java.io.File file)
                         throws java.io.IOException
Constructs a new ReliableFileOutputStream on the File file. If the file exists, it is written over. See the constructor which can append to the file if so desired.

Parameters:
file - the File on which to stream reads.
Throws:
java.io.IOException - If an error occurs opening the file.

ReliableFileOutputStream

public ReliableFileOutputStream(java.io.File file,
                                boolean append)
                         throws java.io.IOException
Constructs a new ReliableFileOutputStream on the File file.

Parameters:
file - the File on which to stream reads.
append - a boolean indicating whether or not to append to an existing file.
Throws:
java.io.IOException - If an error occurs opening the file.

ReliableFileOutputStream

public ReliableFileOutputStream(java.lang.String name)
                         throws java.io.IOException
Constructs a new ReliableFileOutputStream on the file named name. If the file exists, it is written over. See the constructor which can append to the file if so desired. The name may be absolute or relative to the System property "user.dir".

Parameters:
name - the file on which to stream writes.
Throws:
java.io.IOException - If an error occurs opening the file.

ReliableFileOutputStream

public ReliableFileOutputStream(java.lang.String name,
                                boolean append)
                         throws java.io.IOException
Constructs a new ReliableFileOutputStream on the file named name. The name may be absolute or relative to the System property "user.dir".

Parameters:
name - the file on which to stream writes.
append - a boolean indicating whether or not to append to an existing file.
Throws:
java.io.IOException - If an error occurs opening the file.
Method Detail

close

public void close()
           throws java.io.IOException
Closes this output stream and releases any system resources associated with this stream. The general contract of close is that it closes the output stream. A closed stream cannot perform output operations and cannot be reopened.

Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.FilterOutputStream
Throws:
java.io.IOException - If an error occurs closing the file.

closeIntermediateFile

public java.io.File closeIntermediateFile()
                                   throws java.io.IOException
Throws:
java.io.IOException

write

public void write(byte[] b)
           throws java.io.IOException
Override default FilterOutputStream method.

Overrides:
write in class java.io.FilterOutputStream
Throws:
java.io.IOException
See Also:
FilterOutputStream.write(byte[])

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Override default FilterOutputStream method.

Overrides:
write in class java.io.FilterOutputStream
Throws:
java.io.IOException
See Also:
FilterOutputStream.write(byte[], int, int)

write

public void write(int b)
           throws java.io.IOException
Override default FilterOutputStream method.

Overrides:
write in class java.io.FilterOutputStream
Throws:
java.io.IOException
See Also:
FilterOutputStream.write(int)

abort

public void abort()


Copyright © 2007-2012 FuseSource, Corp.. All Rights Reserved.