Package org.eclipse.birt.core.archive

# Class RAFolderOutputStream

java.lang.Object
java.io.OutputStream
org.eclipse.birt.core.archive.RAOutputStream
org.eclipse.birt.core.archive.RAFolderOutputStream

All Implemented Interfaces:
  `Closeable`, `Flushable`, `AutoCloseable`

public class RAFolderOutputStream extends RAOutputStream
RAOutputStream implementation for folder based report archive

## Constructor Summary

Constructors
Constructor
Description
`RAFolderOutputStream(Collection<RAFolderOutputStream> manager, File file)`
`RAFolderOutputStream(Collection<RAFolderOutputStream> manager, File file, boolean append)`

## Method Summary

Modifier and Type
Method
Description
`void`
`close()`
Close the stream.
`void`
`flush()`
Flush the stream.
`String`
`getName()`
`long`
`getOffset()`
`long`
`length()`
`void`
`seek(long localPos)`
Same behavior as the seek in RandomAccessFile.
`void`
`write(byte[] b)`
Writes `b.length` bytes from the specified byte array to this output stream.
`void`
`write(byte[] b, int off, int len)`
Writes `len` bytes from the specified byte array starting at offset `off` to this output stream.
`void`
`write(int b)`
The same behavior as OutputStream.write().
`void`
`writeInt(int v)`
Same behavior as DataOutputStream.writeInt();
`void`
`writeLong(long v)`
Same behavior as DataOutputStream.writeLong();

### Methods inherited from class java.io.OutputStream

`nullOutputStream`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### RAFolderOutputStream

public RAFolderOutputStream(Collection<RAFolderOutputStream> manager, File file) throws FileNotFoundException, IOException

Throws:
  `FileNotFoundException`
  `IOException`

### RAFolderOutputStream

public RAFolderOutputStream(Collection<RAFolderOutputStream> manager, File file, boolean append) throws FileNotFoundException, IOException

Throws:
  `FileNotFoundException`
  `IOException`

## Method Details

### getName

public String getName()

### write

public void write(int b) throws IOException
The same behavior as OutputStream.write().
Writes the specified byte to this output stream. The general contract for `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.

Specified by:
  `write` in class `OutputStream`
Parameters:
  `b` - the `byte`.
Throws:
  `IOException` - if an I/O error occurs. In particular, an `IOException` may be thrown if the output stream has been closed.

### write

public void write(byte[] b) throws IOException
Writes `b.length` bytes from the specified byte array to this output stream. The general contract for `write(b)` is that it should have exactly the same effect as the call `write(b, 0, b.length)`.

Overrides:
  `write` in class `OutputStream`
Parameters:
  `b` - the data.
Throws:
  `IOException` - if an I/O error occurs.
See Also:
  - `OutputStream.write(byte[], int, int)`

### write

public void write(byte[] b, int off, int len) throws IOException
Writes `len` bytes from the specified byte array starting at offset `off` to this output stream. The general contract for `write(b, off, len)` is that some of the bytes in the array `b` are written to the output stream in order; element `b[off]` is the first byte written and `b[off+len-1]` is the last byte written by this operation.

Overrides:
  `write` in class `OutputStream`
Parameters:
  `b` - the data.
  `off` - the start offset in the data.
  `len` - the number of bytes to write.
Throws:
  `IOException` - if an I/O error occurs.

### writeInt

public void writeInt(int v) throws IOException
Same behavior as DataOutputStream.writeInt();

Specified by:
  `writeInt` in class `RAOutputStream`
Throws:
  `IOException`

### writeLong

public void writeLong(long v) throws IOException
Same behavior as DataOutputStream.writeLong();

Specified by:
  `writeLong` in class `RAOutputStream`
Throws:
  `IOException`

### getOffset

public long getOffset() throws IOException

Specified by:
  `getOffset` in class `RAOutputStream`
Throws:
  `IOException`

### seek

public void seek(long localPos) throws IOException
Same behavior as the seek in RandomAccessFile.
Sets the file-pointer offset, measured from the beginning of this file, at which the next read or write occurs. The offset may be set beyond the end of the file. Setting the offset beyond the end of the file does not change the file length. The file length will change only by writing after the offset has been set beyond the end of the file.

Specified by:
  `seek` in class `RAOutputStream`
Parameters:
  `localPos` - - the new local postion in the stream, measured in bytes from the beginning of the stream
Throws:
  `IOException`

### flush

public void flush() throws IOException
Flush the stream.

Specified by:
  `flush` in interface `Flushable`
Overrides:
  `flush` in class `OutputStream`
Throws:
  `IOException`

### close

public void close() throws IOException
Close the stream. If the stream is the only one in the underlying file, the file will be close too.

Specified by:
  `close` in interface `AutoCloseable`
Specified by:
  `close` in interface `Closeable`
Overrides:
  `close` in class `OutputStream`
Throws:
  `IOException`

### length

public long length() throws IOException

Specified by:
  `length` in class `RAOutputStream`
Throws:
  `IOException`