An auto-resize buffer to write data into a ByteBuffer.
| Methods |
| int |
capacity()
Get the capacity.
|
| int |
capacity()
Get the capacity.
Returns:
the capacity
|
| WriteBuffer |
clear()
Clear the buffer after use.
|
| WriteBuffer |
clear()
Clear the buffer after use.
Returns:
this
|
| WriteBuffer |
get(byte[] dst)
Copy the data into the destination array.
|
| WriteBuffer |
get(byte[] dst)
Copy the data into the destination array.
Parameters:
dst - the destination array
Returns:
this
|
| ByteBuffer |
getBuffer()
Get the byte buffer.
|
| ByteBuffer |
getBuffer()
Get the byte buffer.
Returns:
the byte buffer
|
| WriteBuffer |
limit(int newLimit)
Set the limit, possibly growing the buffer.
|
| WriteBuffer |
limit(int newLimit)
Set the limit, possibly growing the buffer.
Parameters:
newLimit - the new limit
Returns:
this
|
| int |
limit()
Get the limit.
|
| int |
limit()
Get the limit.
Returns:
the limit
|
| WriteBuffer |
position(int newPosition)
Set the position.
|
| WriteBuffer |
position(int newPosition)
Set the position.
Parameters:
newPosition - the new position
Returns:
the new position
|
| int |
position()
Get the current position.
|
| int |
position()
Get the current position.
Returns:
the position
|
| WriteBuffer |
put(byte x)
Put a byte.
|
| WriteBuffer |
put(byte x)
Put a byte.
Parameters:
x - the value
Returns:
this
|
| WriteBuffer |
put(byte[] bytes)
Put a byte array.
|
| WriteBuffer |
put(byte[] bytes)
Put a byte array.
Parameters:
bytes - the value
Returns:
this
|
| WriteBuffer |
put(byte[] bytes, int offset, int length)
Put a byte array.
|
| WriteBuffer |
put(byte[] bytes, int offset, int length)
Put a byte array.
Parameters:
bytes - the value
offset - the source offset
length - the number of bytes
Returns:
this
|
| WriteBuffer |
put(ByteBuffer src)
Put the contents of a byte buffer.
|
| WriteBuffer |
put(ByteBuffer src)
Put the contents of a byte buffer.
Parameters:
src - the source buffer
Returns:
this
|
| WriteBuffer |
putChar(char x)
Put a character.
|
| WriteBuffer |
putChar(char x)
Put a character.
Parameters:
x - the value
Returns:
this
|
| WriteBuffer |
putDouble(double x)
Put a double.
|
| WriteBuffer |
putDouble(double x)
Put a double.
Parameters:
x - the value
Returns:
this
|
| WriteBuffer |
putFloat(float x)
Put a float.
|
| WriteBuffer |
putFloat(float x)
Put a float.
Parameters:
x - the value
Returns:
this
|
| WriteBuffer |
putInt(int x)
Put an integer.
|
| WriteBuffer |
putInt(int x)
Put an integer.
Parameters:
x - the value
Returns:
this
|
| WriteBuffer |
putInt(int index, int value)
Update an integer at the given index.
|
| WriteBuffer |
putInt(int index, int value)
Update an integer at the given index.
Parameters:
index - the index
value - the value
Returns:
this
|
| WriteBuffer |
putLong(long x)
Put a long.
|
| WriteBuffer |
putLong(long x)
Put a long.
Parameters:
x - the value
Returns:
this
|
| WriteBuffer |
putShort(short x)
Put a short.
|
| WriteBuffer |
putShort(short x)
Put a short.
Parameters:
x - the value
Returns:
this
|
| WriteBuffer |
putShort(int index, short value)
Update a short at the given index.
|
| WriteBuffer |
putShort(int index, short value)
Update a short at the given index.
Parameters:
index - the index
value - the value
Returns:
this
|
| WriteBuffer |
putStringData(String s, int len)
Write the characters of a string in a format similar to UTF-8.
|
| WriteBuffer |
putStringData(String s, int len)
Write the characters of a string in a format similar to UTF-8.
Parameters:
s - the string
len - the number of characters to write
Returns:
this
|
| WriteBuffer |
putVarInt(int x)
Write a variable size integer.
|
| WriteBuffer |
putVarInt(int x)
Write a variable size integer.
Parameters:
x - the value
Returns:
this
|
| WriteBuffer |
putVarLong(long x)
Write a variable size long.
|
| WriteBuffer |
putVarLong(long x)
Write a variable size long.
Parameters:
x - the value
Returns:
this
|