Berkeley DB version 4.2.52

## com.sleepycat.bdb.util
Class FastOutputStream

    java.lang.Object
      |
      +--java.io.OutputStream
            |
            +--com.sleepycat.bdb.util.FastOutputStream

Direct Known Subclasses:
  TupleOutput

public class FastOutputStream
extends OutputStream

A replacement for ByteArrayOutputStream that does not synchronize every byte read.

Field Summary
`static int` `DEFAULT_BUMP_SIZE`
`static int` `DEFAULT_INIT_SIZE`

Constructor Summary
`FastOutputStream()` Creates an output stream with default sizes.
`FastOutputStream(byte[] buffer)` Creates an output stream with a given initial buffer and a default bump size.
`FastOutputStream(byte[] buffer, int bumpSize)` Creates an output stream with a given initial buffer and a given bump size.
`FastOutputStream(int initialSize)` Creates an output stream with a default bump size and a given initial size.
`FastOutputStream(int initialSize, int bumpSize)` Creates an output stream with a given bump size and initial size.

Method Summary
`void` `addSize(int sizeAdded)` Skip the given number of bytes in the buffer.
`byte[]` `getBufferBytes()` Returns the buffer owned by this object.
`int` `getBufferLength()` Returns the length used in the internal buffer, that is, the offset at which data will be written next.
`int` `getBufferOffset()` Returns the offset of the internal buffer.
`void` `makeSpace(int sizeNeeded)` Ensure that at least the given number of bytes are available in the internal buffer.
`void` `reset()`
`int` `size()`
`byte[]` `toByteArray()`
`void` `toByteArray(byte[] toBuf, int offset)` Copy the buffered data to the given array.
`String` `toString()`
`String` `toString(String encoding)`
`void` `write(byte[] fromBuf)`
`void` `write(byte[] fromBuf, int offset, int length)`
`void` `write(int b)`
`void` `writeTo(OutputStream out)`

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

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

Field Detail

### DEFAULT_INIT_SIZE

    public static final int DEFAULT_INIT_SIZE

See Also:
  Constant Field Values

### DEFAULT_BUMP_SIZE

    public static final int DEFAULT_BUMP_SIZE

See Also:
  Constant Field Values

Constructor Detail

### FastOutputStream

    public FastOutputStream()

  Creates an output stream with default sizes.

### FastOutputStream

    public FastOutputStream(int initialSize)

  Creates an output stream with a default bump size and a given initial size.

Parameters:
  `initialSize` - the initial size of the buffer.

### FastOutputStream

    public FastOutputStream(int initialSize,
                            int bumpSize)

  Creates an output stream with a given bump size and initial size.

Parameters:
  `initialSize` - the initial size of the buffer.
  `bumpSize` - the amount to increment the buffer.

### FastOutputStream

    public FastOutputStream(byte[] buffer)

  Creates an output stream with a given initial buffer and a default bump size.

Parameters:
  `buffer` - the initial buffer; will be owned by this object.

### FastOutputStream

    public FastOutputStream(byte[] buffer,
                            int bumpSize)

  Creates an output stream with a given initial buffer and a given bump size.

Parameters:
  `buffer` - the initial buffer; will be owned by this object.
  `bumpSize` - the amount to increment the buffer.

Method Detail

### size

    public int size()

### reset

    public void reset()

### write

    public void write(int b)
               throws IOException

  Specified by:
    `write` in class `OutputStream`
    `IOException`

### write

    public void write(byte[] fromBuf)
               throws IOException

  Overrides:
    `write` in class `OutputStream`
    `IOException`

### write

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

  Overrides:
    `write` in class `OutputStream`
    `IOException`

### writeTo

    public void writeTo(OutputStream out)
                 throws IOException

    `IOException`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### toString

    public String toString(String encoding)
                    throws UnsupportedEncodingException

    `UnsupportedEncodingException`

### toByteArray

    public byte[] toByteArray()

### toByteArray

    public void toByteArray(byte[] toBuf,
                            int offset)

  Copy the buffered data to the given array.

  Parameters:
    `toBuf` - the buffer to hold a copy of the data.
    `offset` - the offset at which to start copying.

### getBufferBytes

    public byte[] getBufferBytes()

  Returns the buffer owned by this object.

  Returns:
    the buffer.

### getBufferOffset

    public int getBufferOffset()

  Returns the offset of the internal buffer.

  Returns:
    always zero currently.

### getBufferLength

    public int getBufferLength()

  Returns the length used in the internal buffer, that is, the offset at which data will be written next.

  Returns:
    the buffer length.

### makeSpace

    public void makeSpace(int sizeNeeded)

  Ensure that at least the given number of bytes are available in the internal buffer.

  Parameters:
    `sizeNeeded` - the number of bytes desired.

### addSize

    public void addSize(int sizeAdded)

  Skip the given number of bytes in the buffer.

  Parameters:
    `sizeAdded` - number of bytes to skip.

Berkeley DB version 4.2.52

Copyright (c) 1996-2003 Sleepycat Software, Inc. - All rights reserved.