Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.pdfbox.io
Class RandomAccessFileOutputStream

    java.lang.Object
      java.io.OutputStream
          org.pdfbox.io.RandomAccessFileOutputStream

public class RandomAccessFileOutputStream
extends OutputStream

This will write to a RandomAccessFile in the filesystem and keep track of the position it is writing to and the length of the stream.

Version:
  $Revision: 1.3 $
Author:
  Ben Litchfield (ben@csh.rit.edu)

Constructor Summary
`RandomAccessFileOutputStream(RandomAccessFile raf)` Constructor to create an output stream that will write to the end of a random access file.

Method Summary
`COSBase` | `getExpectedLength()` This will get the length that the PDF document specified this stream should be.
`long` | `getLength()` The number of bytes written to the stream.
`long` | `getPosition()` This will get the position in the RAF that the stream was written to.
`void` | `setExpectedLength(COSBase value)` This will set the expected length of this stream.
`void` | `write(byte[] b, int offset, int length)`
`void` | `write(int b)`

Methods inherited from class java.io.OutputStream
`close, flush, write`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### RandomAccessFileOutputStream

    public RandomAccessFileOutputStream(RandomAccessFile raf)
                                 throws IOException

  Constructor to create an output stream that will write to the end of a random access file.

Parameters:
  `raf` - The file to write to.
Throws:
  `IOException` - If there is a problem accessing the raf.

Method Detail

### getPosition

    public long getPosition()

  This will get the position in the RAF that the stream was written to.

  Returns:
    The position in the raf where the file can be obtained.

### getLength

    public long getLength()

  The number of bytes written to the stream.

  Returns:
    The number of bytes read to the stream.

### write

    public void write(byte[] b,
                      int offset,
                      int length)
               throws IOException

  Throws:
    `IOException`
  See Also:
    `OutputStream.write( byte[], int, int )`

### write

    public void write(int b)
               throws IOException

  Throws:
    `IOException`
  See Also:
    `OutputStream.write( int )`

### getExpectedLength

    public COSBase getExpectedLength()

  This will get the length that the PDF document specified this stream should be. This may not match the number of bytes read.

  Returns:
    The expected length.

### setExpectedLength

    public void setExpectedLength(COSBase value)

  This will set the expected length of this stream.

  Parameters:
    `value` - The expected value.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD