public abstract class ExpandableBufferWriter extends Object
| Constructor and Description |
|---|
ExpandableBufferWriter() |
| Modifier and Type | Method and Description |
|---|---|
OutputStream |
asOutputStream() |
protected abstract void |
ensureCapacity(int delta) |
abstract Buffer |
getBuffer() |
abstract int |
position() |
abstract void |
position(int pos) |
ExpandableBufferWriter |
put(byte b)
Relative put method (optional operation).
|
ExpandableBufferWriter |
put(byte[] src)
Relative bulk put method (optional operation).
|
ExpandableBufferWriter |
put(byte[] src,
int offset,
int length)
Relative bulk put method (optional operation).
|
ExpandableBufferWriter |
put(int index,
byte b)
Absolute put method (optional operation).
|
ExpandableBufferWriter |
putChar(char value)
Relative put method for writing a char value (optional operation).
|
ExpandableBufferWriter |
putChar(int index,
char value)
Absolute put method for writing a char value (optional operation).
|
ExpandableBufferWriter |
putDouble(double value)
Relative put method for writing a double value (optional operation).
|
ExpandableBufferWriter |
putDouble(int index,
double value)
Absolute put method for writing a double value (optional operation).
|
ExpandableBufferWriter |
putFloat(float value)
Relative put method for writing a float value (optional operation).
|
ExpandableBufferWriter |
putFloat(int index,
float value)
Absolute put method for writing a float value (optional operation).
|
ExpandableBufferWriter |
putInt(int value)
Relative put method for writing an int value (optional operation).
|
ExpandableBufferWriter |
putInt(int index,
int value)
Absolute put method for writing an int value (optional operation).
|
ExpandableBufferWriter |
putLong(int index,
long value)
Absolute put method for writing a long value (optional operation).
|
ExpandableBufferWriter |
putLong(long value)
Relative put method for writing a long value (optional operation).
|
ExpandableBufferWriter |
putShort(int index,
short value)
Absolute put method for writing a short value (optional operation).
|
ExpandableBufferWriter |
putShort(short value)
Relative put method for writing a short value (optional operation).
|
void |
reserve(int size) |
abstract Buffer |
toBuffer() |
public abstract Buffer getBuffer()
public abstract Buffer toBuffer()
public abstract int position()
public abstract void position(int pos)
protected abstract void ensureCapacity(int delta)
public void reserve(int size)
public ExpandableBufferWriter put(byte b)
Writes the given byte into this buffer at the current position, and then increments the position.
b - The byte to be writtenBufferOverflowException - If this buffer's current position is not smaller than its limitReadOnlyBufferException - If this buffer is read-onlypublic ExpandableBufferWriter put(int index, byte b)
Writes the given byte into this buffer at the given index.
index - The index at which the byte will be writtenb - The byte value to be writtenIndexOutOfBoundsException - If index is negative or not smaller than the buffer's limitReadOnlyBufferException - If this buffer is read-onlypublic ExpandableBufferWriter put(byte[] src)
This method transfers the entire content of the given source byte array into this buffer. An invocation of this method of the form dst.put(a) behaves in exactly the same way as the invocation
dst.put(a, 0, a.length)
src - the source byte arrayBufferOverflowException - If there is insufficient space in this bufferReadOnlyBufferException - If this buffer is read-onlypublic ExpandableBufferWriter put(byte[] src, int offset, int length)
This method transfers bytes into this buffer from the given source array. If there are more bytes to be copied from
the array than remain in this buffer, that is, if length > remaining(), then
no bytes are transferred and a BufferOverflowException is thrown.
Otherwise, this method copies length bytes from the given array into this buffer, starting at the given offset in the array and at the current position of this buffer. The position of this buffer is then incremented by length.
In other words, an invocation of this method of the form dst.put(src, off, len) has exactly the same effect as the loop
for (int i = off; i < off + len; i++)
dst.put(a[i]);
except that it first checks that there is sufficient space in this buffer and it is potentially much more efficient.
src - The array from which bytes are to be readoffset - The offset within the array of the first byte to be read; must be non-negative and no larger than
array.lengthlength - The number of bytes to be read from the given array; must be non-negative and no larger than
array.length - offsetBufferOverflowException - If there is insufficient space in this bufferIndexOutOfBoundsException - If the preconditions on the offset and length parameters do not
holdReadOnlyBufferException - If this buffer is read-onlypublic ExpandableBufferWriter putChar(char value)
Writes two bytes containing the given char value, in the current byte order, into this buffer at the current position, and then increments the position by two.
value - The char value to be writtenBufferOverflowException - If there are fewer than two bytes remaining in this bufferReadOnlyBufferException - If this buffer is read-onlypublic ExpandableBufferWriter putChar(int index, char value)
Writes two bytes containing the given char value, in the current byte order, into this buffer at the given index.
index - The index at which the bytes will be writtenvalue - The char value to be writtenIndexOutOfBoundsException - If index is negative or not smaller than the buffer's limit, minus oneReadOnlyBufferException - If this buffer is read-onlypublic ExpandableBufferWriter putShort(short value)
Writes two bytes containing the given short value, in the current byte order, into this buffer at the current position, and then increments the position by two.
value - The short value to be writtenBufferOverflowException - If there are fewer than two bytes remaining in this bufferReadOnlyBufferException - If this buffer is read-onlypublic ExpandableBufferWriter putShort(int index, short value)
Writes two bytes containing the given short value, in the current byte order, into this buffer at the given index.
index - The index at which the bytes will be writtenvalue - The short value to be writtenIndexOutOfBoundsException - If index is negative or not smaller than the buffer's limit, minus oneReadOnlyBufferException - If this buffer is read-onlypublic ExpandableBufferWriter putInt(int value)
Writes four bytes containing the given int value, in the current byte order, into this buffer at the current position, and then increments the position by four.
value - The int value to be writtenBufferOverflowException - If there are fewer than four bytes remaining in this bufferReadOnlyBufferException - If this buffer is read-onlypublic ExpandableBufferWriter putInt(int index, int value)
Writes four bytes containing the given int value, in the current byte order, into this buffer at the given index.
index - The index at which the bytes will be writtenvalue - The int value to be writtenIndexOutOfBoundsException - If index is negative or not smaller than the buffer's limit, minus threeReadOnlyBufferException - If this buffer is read-onlypublic ExpandableBufferWriter putLong(long value)
Writes eight bytes containing the given long value, in the current byte order, into this buffer at the current position, and then increments the position by eight.
value - The long value to be writtenBufferOverflowException - If there are fewer than eight bytes remaining in this bufferReadOnlyBufferException - If this buffer is read-onlypublic ExpandableBufferWriter putLong(int index, long value)
Writes eight bytes containing the given long value, in the current byte order, into this buffer at the given index.
index - The index at which the bytes will be writtenvalue - The long value to be writtenIndexOutOfBoundsException - If index is negative or not smaller than the buffer's limit, minus sevenReadOnlyBufferException - If this buffer is read-onlypublic ExpandableBufferWriter putFloat(float value)
Writes four bytes containing the given float value, in the current byte order, into this buffer at the current position, and then increments the position by four.
value - The float value to be writtenBufferOverflowException - If there are fewer than four bytes remaining in this bufferReadOnlyBufferException - If this buffer is read-onlypublic ExpandableBufferWriter putFloat(int index, float value)
Writes four bytes containing the given float value, in the current byte order, into this buffer at the given index.
index - The index at which the bytes will be writtenvalue - The float value to be writtenIndexOutOfBoundsException - If index is negative or not smaller than the buffer's limit, minus threeReadOnlyBufferException - If this buffer is read-onlypublic ExpandableBufferWriter putDouble(double value)
Writes eight bytes containing the given double value, in the current byte order, into this buffer at the current position, and then increments the position by eight.
value - The double value to be writtenBufferOverflowException - If there are fewer than eight bytes remaining in this bufferReadOnlyBufferException - If this buffer is read-onlypublic ExpandableBufferWriter putDouble(int index, double value)
Writes eight bytes containing the given double value, in the current byte order, into this buffer at the given index.
index - The index at which the bytes will be writtenvalue - The double value to be writtenIndexOutOfBoundsException - If index is negative or not smaller than the buffer's limit, minus sevenReadOnlyBufferException - If this buffer is read-onlypublic OutputStream asOutputStream()
Copyright © 2017–2020 Eclipse Foundation. All rights reserved.