Main Page | Class Hierarchy | Data Structures | Directories | File List | Data Fields | Related Pages

com::sleepycat::util::FastOutputStream Class Reference

Inheritance diagram for com::sleepycat::util::FastOutputStream:

com::sleepycat::bind::tuple::TupleOutput

Public Member Functions

 FastOutputStream ()
 FastOutputStream (int initialSize)
 FastOutputStream (int initialSize, int bumpSize)
 FastOutputStream (byte[] buffer)
 FastOutputStream (byte[] buffer, int bumpSize)
final void writeFast (int b)
final void writeFast (byte[] fromBuf)
final void writeFast (byte[] fromBuf, int offset, int length)
byte[] getBufferBytes ()
int getBufferOffset ()
int getBufferLength ()
void makeSpace (int sizeNeeded)
void addSize (int sizeAdded)

Static Public Attributes

static final int DEFAULT_INIT_SIZE = 100
static final int DEFAULT_BUMP_SIZE = 0

Detailed Description

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

This class extends OutputStream and its write() methods allow it to be used as a standard output stream. In addition, it provides writeFast() methods that are not declared to throw IOException. IOException is never thrown by this class.

Author:
Mark Hayes

Definition at line 28 of file FastOutputStream.java.


Constructor & Destructor Documentation

com::sleepycat::util::FastOutputStream::FastOutputStream  )  [inline]
 

Creates an output stream with default sizes.

Definition at line 49 of file FastOutputStream.java.

References DEFAULT_BUMP_SIZE, and DEFAULT_INIT_SIZE.

com::sleepycat::util::FastOutputStream::FastOutputStream int  initialSize  )  [inline]
 

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

Parameters:
initialSize the initial size of the buffer.

Definition at line 60 of file FastOutputStream.java.

References DEFAULT_BUMP_SIZE.

com::sleepycat::util::FastOutputStream::FastOutputStream int  initialSize,
int  bumpSize
[inline]
 

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.

Definition at line 72 of file FastOutputStream.java.

com::sleepycat::util::FastOutputStream::FastOutputStream byte[]  buffer  )  [inline]
 

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.

Definition at line 83 of file FastOutputStream.java.

References DEFAULT_BUMP_SIZE.

com::sleepycat::util::FastOutputStream::FastOutputStream byte[]  buffer,
int  bumpSize
[inline]
 

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. If zero (the default), the current buffer size will be doubled when the buffer is full.

Definition at line 99 of file FastOutputStream.java.


Member Function Documentation

void com::sleepycat::util::FastOutputStream::addSize int  sizeAdded  )  [inline]
 

Skip the given number of bytes in the buffer.

Parameters:
sizeAdded number of bytes to skip.

Definition at line 257 of file FastOutputStream.java.

Referenced by com::sleepycat::bind::tuple::TupleOutput::writeString().

byte [] com::sleepycat::util::FastOutputStream::getBufferBytes  )  [inline]
 

Returns the buffer owned by this object.

Returns:
the buffer.

Definition at line 213 of file FastOutputStream.java.

Referenced by com::sleepycat::bind::serial::SerialBinding::objectToEntry(), com::sleepycat::bind::tuple::TupleBase::outputToEntry(), com::sleepycat::bind::tuple::TupleInput::TupleInput(), and com::sleepycat::bind::tuple::TupleOutput::writeString().

int com::sleepycat::util::FastOutputStream::getBufferLength  )  [inline]
 

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

Returns:
the buffer length.

Definition at line 234 of file FastOutputStream.java.

Referenced by com::sleepycat::bind::serial::SerialBinding::objectToEntry(), com::sleepycat::bind::tuple::TupleBase::outputToEntry(), com::sleepycat::bind::tuple::TupleInput::TupleInput(), and com::sleepycat::bind::tuple::TupleOutput::writeString().

int com::sleepycat::util::FastOutputStream::getBufferOffset  )  [inline]
 

Returns the offset of the internal buffer.

Returns:
always zero currently.

Definition at line 223 of file FastOutputStream.java.

Referenced by com::sleepycat::bind::tuple::TupleBase::outputToEntry(), and com::sleepycat::bind::tuple::TupleInput::TupleInput().

void com::sleepycat::util::FastOutputStream::makeSpace int  sizeNeeded  )  [inline]
 

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

Parameters:
sizeNeeded the number of bytes desired.

Definition at line 245 of file FastOutputStream.java.

Referenced by com::sleepycat::bind::tuple::TupleOutput::writeString().

final void com::sleepycat::util::FastOutputStream::writeFast byte[]  fromBuf,
int  offset,
int  length
[inline]
 

Equivalent to write(byte[],int,int) but does not throw IOException.

See also:
#write(byte[],int,int)

Definition at line 198 of file FastOutputStream.java.

final void com::sleepycat::util::FastOutputStream::writeFast byte[]  fromBuf  )  [inline]
 

Equivalent to write(byte[]) but does not throw IOException.

See also:
#write(byte[])

Definition at line 183 of file FastOutputStream.java.

final void com::sleepycat::util::FastOutputStream::writeFast int  b  )  [inline]
 

Equivalent to write(int) but does not throw IOException.

See also:
#write(int)

Definition at line 170 of file FastOutputStream.java.

Referenced by com::sleepycat::bind::tuple::TupleOutput::writeBoolean(), com::sleepycat::bind::tuple::TupleOutput::writeBytes(), com::sleepycat::bind::tuple::TupleOutput::writeChar(), com::sleepycat::bind::tuple::TupleOutput::writeChars(), com::sleepycat::bind::tuple::TupleOutput::writeString(), com::sleepycat::bind::tuple::TupleOutput::writeUnsignedByte(), com::sleepycat::bind::tuple::TupleOutput::writeUnsignedInt(), and com::sleepycat::bind::tuple::TupleOutput::writeUnsignedShort().


Field Documentation

final int com::sleepycat::util::FastOutputStream::DEFAULT_BUMP_SIZE = 0 [static]
 

The default amount that the buffer is increased when it is full. This constant is zero, which means to double the current buffer size.

Definition at line 40 of file FastOutputStream.java.

Referenced by FastOutputStream().

final int com::sleepycat::util::FastOutputStream::DEFAULT_INIT_SIZE = 100 [static]
 

The default initial size of the buffer if no initialSize parameter is specified. This constant is 100 bytes.

Definition at line 34 of file FastOutputStream.java.

Referenced by FastOutputStream().


The documentation for this class was generated from the following file:
Generated on Sun Dec 25 12:15:02 2005 for Berkeley DB 4.4.16 by  doxygen 1.4.2