com.sleepycat.util
public class FastOutputStream extends OutputStream
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.
Field Summary | |
---|---|
static int | DEFAULT_BUMP_SIZE
The default amount that the buffer is increased when it is full. |
static int | DEFAULT_INIT_SIZE
The default initial size of the buffer if no initialSize parameter is
specified. |
Constructor Summary | |
---|---|
FastOutputStream()
Creates an output stream with default sizes. | |
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.
| |
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.
|
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, i.e., 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() |
String | toString() |
String | toString(String encoding) |
void | write(int b) |
void | write(byte[] fromBuf) |
void | write(byte[] fromBuf, int offset, int length) |
void | writeFast(int b)
Equivalent to write(int) |
void | writeFast(byte[] fromBuf)
Equivalent to write(byte[]) |
void | writeFast(byte[] fromBuf, int offset, int length)
Equivalent to write(byte[],int,int) |
void | writeTo(OutputStream out) |
Parameters: initialSize the initial size of the buffer.
Parameters: initialSize the initial size of the buffer. bumpSize the amount to increment the buffer.
Parameters: buffer the initial buffer; will be owned by this object.
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.
Parameters: sizeAdded number of bytes to skip.
Returns: the buffer.
Returns: the buffer length.
Returns: always zero currently.
Parameters: sizeNeeded the number of bytes desired.
write(int) but does not throw
IOException
.See Also: FastOutputStream
write(byte[]) but does not throw
IOException
.See Also: (byte[])
write(byte[],int,int) but does not throw
IOException
.See Also: (byte[],int,int)