public class WriteBuffer extends Object
Constructor and Description |
---|
WriteBuffer() |
WriteBuffer(int initialSize) |
Modifier and Type | Method and Description |
---|---|
int |
capacity()
Get the capacity.
|
WriteBuffer |
clear()
Clear the buffer after use.
|
WriteBuffer |
get(byte[] dst)
Copy the data into the destination array.
|
ByteBuffer |
getBuffer()
Get the byte buffer.
|
int |
limit()
Get the limit.
|
WriteBuffer |
limit(int newLimit)
Set the limit, possibly growing the buffer.
|
int |
position()
Get the current position.
|
WriteBuffer |
position(int newPosition)
Set the position.
|
WriteBuffer |
put(byte x)
Put a byte.
|
WriteBuffer |
put(byte[] bytes)
Put a byte array.
|
WriteBuffer |
put(byte[] bytes,
int offset,
int length)
Put a byte array.
|
WriteBuffer |
put(ByteBuffer src)
Put the contents of a byte buffer.
|
WriteBuffer |
putChar(char x)
Put a character.
|
WriteBuffer |
putDouble(double x)
Put a double.
|
WriteBuffer |
putFloat(float x)
Put a float.
|
WriteBuffer |
putInt(int x)
Put an integer.
|
WriteBuffer |
putInt(int index,
int value)
Update an integer at the given index.
|
WriteBuffer |
putLong(long x)
Put a long.
|
WriteBuffer |
putShort(int index,
short value)
Update a short at the given index.
|
WriteBuffer |
putShort(short x)
Put a short.
|
WriteBuffer |
putStringData(String s,
int len)
Write the characters of a string in a format similar to UTF-8.
|
WriteBuffer |
putVarInt(int x)
Write a variable size integer.
|
WriteBuffer |
putVarLong(long x)
Write a variable size long.
|
public WriteBuffer putVarInt(int x)
x
- the valuepublic WriteBuffer putVarLong(long x)
x
- the valuepublic WriteBuffer putStringData(String s, int len)
s
- the stringlen
- the number of characters to writepublic WriteBuffer put(byte x)
x
- the valuepublic WriteBuffer putChar(char x)
x
- the valuepublic WriteBuffer putShort(short x)
x
- the valuepublic WriteBuffer putInt(int x)
x
- the valuepublic WriteBuffer putLong(long x)
x
- the valuepublic WriteBuffer putFloat(float x)
x
- the valuepublic WriteBuffer putDouble(double x)
x
- the valuepublic WriteBuffer put(byte[] bytes)
bytes
- the valuepublic WriteBuffer put(byte[] bytes, int offset, int length)
bytes
- the valueoffset
- the source offsetlength
- the number of bytespublic WriteBuffer put(ByteBuffer src)
src
- the source bufferpublic WriteBuffer limit(int newLimit)
newLimit
- the new limitpublic int capacity()
public WriteBuffer position(int newPosition)
newPosition
- the new positionpublic int limit()
public int position()
public WriteBuffer get(byte[] dst)
dst
- the destination arraypublic WriteBuffer putInt(int index, int value)
index
- the indexvalue
- the valuepublic WriteBuffer putShort(int index, short value)
index
- the indexvalue
- the valuepublic WriteBuffer clear()
public ByteBuffer getBuffer()
Copyright © 2017 JBoss by Red Hat. All rights reserved.