public class ByteBuffer extends Object implements IApimanBuffer
IApimanBuffer from a byte array. Don't use this class
directly - create and manage buffers by using the IBufferFactoryComponent
instead! The factory will give you a platform-specific buffer implementation.| Constructor and Description |
|---|
ByteBuffer(byte[] byteData) |
ByteBuffer(byte[] buffer,
int size)
Constructor.
|
ByteBuffer(int size)
Constructor.
|
ByteBuffer(String stringData)
Constructor.
|
ByteBuffer(String stringData,
String enc)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
append(byte b) |
void |
append(byte[] bytes) |
void |
append(byte[] bytes,
int offset,
int length)
Byte array to append with given offset and length.
|
void |
append(IApimanBuffer buffer) |
void |
append(IApimanBuffer buffer,
int offset,
int length) |
void |
append(String string) |
void |
append(String string,
String encoding) |
byte |
get(int index) |
byte[] |
getBytes() |
byte[] |
getBytes(int start,
int end)
Get ApimanBuffer as byte array constrained by indices.
|
int |
getBytesInBuffer() |
Object |
getNativeBuffer()
Get encapsulated native buffer.
|
String |
getString(int start,
int end) |
String |
getString(int start,
int end,
String encoding) |
void |
insert(int index,
byte[] b)
Inserts data from byte array into the index location.
|
void |
insert(int index,
byte[] b,
int offset,
int length)
Inserts data from the byte array constrained by offset and length.
|
void |
insert(int index,
IApimanBuffer buffer)
Inserts data at given index with buffer.
|
void |
insert(int index,
IApimanBuffer buffer,
int offset,
int length)
Inserts data at the given index with buffer at given offset and constrained length.
|
void |
insert(int index,
String string)
Inserts data at index from value of string.
|
void |
insert(int index,
String string,
String encoding)
Inserts data at index from value of string.
|
int |
length() |
int |
readFrom(InputStream stream)
Reads from the input stream.
|
void |
set(int index,
byte b) |
String |
toString() |
String |
toString(String encoding) |
public ByteBuffer(byte[] buffer,
int size)
buffer - size - public ByteBuffer(int size)
size - initial sizepublic ByteBuffer(String stringData)
stringData - String datapublic ByteBuffer(String stringData, String enc)
stringData - String dataenc - String data encodingpublic ByteBuffer(byte[] byteData)
byteData - the byte data to initialize bufferpublic Object getNativeBuffer()
IApimanBuffergetNativeBuffer in interface IApimanBufferIApimanBuffer.getNativeBuffer()public int length()
length in interface IApimanBufferIApimanBuffer.length()public void insert(int index,
IApimanBuffer buffer)
IApimanBufferinsert in interface IApimanBufferIApimanBuffer.insert(int, io.apiman.gateway.engine.io.IApimanBuffer)public void insert(int index,
IApimanBuffer buffer,
int offset,
int length)
IApimanBufferinsert in interface IApimanBufferindex - ApimanBuffer indexbuffer - Provided bufferoffset - Provided buffer offset indexlength - Provided buffer maximum length to setIApimanBuffer.insert(int, io.apiman.gateway.engine.io.IApimanBuffer, int, int)public void append(IApimanBuffer buffer)
append in interface IApimanBufferbuffer - Buffer to appendIApimanBuffer.append(io.apiman.gateway.engine.io.IApimanBuffer)public void append(IApimanBuffer buffer, int offset, int length)
append in interface IApimanBufferbuffer - Buffer to appendoffset - Provided buffer offsetlength - Provided buffer maximum length to appendIApimanBuffer.append(io.apiman.gateway.engine.io.IApimanBuffer, int, int)public byte get(int index)
get in interface IApimanBufferindex - Index of byte to retrieveIApimanBuffer.get(int)public void set(int index,
byte b)
set in interface IApimanBufferindex - Index of byte to setb - Byte value to setIApimanBuffer.set(int, byte)public void append(byte b)
append in interface IApimanBufferb - Byte value to appendIApimanBuffer.append(byte)public byte[] getBytes()
getBytes in interface IApimanBufferIApimanBuffer.getBytes()public byte[] getBytes(int start,
int end)
IApimanBuffergetBytes in interface IApimanBufferstart - Start index inclusiveend - End index exclusiveIApimanBuffer.getBytes(int, int)public void insert(int index,
byte[] b)
IApimanBufferinsert in interface IApimanBufferindex - Start indexb - Byte array to setIApimanBuffer.insert(int, byte[])public void insert(int index,
byte[] b,
int offset,
int length)
IApimanBufferinsert in interface IApimanBufferindex - ApimanBuffer start indexb - Byte Array to setoffset - Byte array start indexlength - Byte array maximum length to appendIApimanBuffer.insert(int, byte[], int, int)public void append(byte[] bytes)
append in interface IApimanBufferbytes - Byte array to append.IApimanBuffer.append(byte[])public void append(byte[] bytes,
int offset,
int length)
IApimanBufferappend in interface IApimanBufferbytes - Byte array to appendoffset - Byte array start indexlength - Maximum length to appendIApimanBuffer.append(byte[], int, int)public String getString(int start, int end)
getString in interface IApimanBufferstart - start indexend - end indexIApimanBuffer.getString(int, int)public String getString(int start, int end, String encoding)
getString in interface IApimanBufferstart - start indexend - end indexencoding - string encodingIApimanBuffer.getString(int, int, java.lang.String)public void insert(int index,
String string)
IApimanBufferinsert in interface IApimanBufferindex - ApimanBuffer indexstring - String to set as bytesIApimanBuffer.insert(int, java.lang.String)public void insert(int index,
String string,
String encoding)
IApimanBufferinsert in interface IApimanBufferindex - ApimanBuffer indexstring - String to set as bytesencoding - Encoding of stringIApimanBuffer.insert(int, java.lang.String, java.lang.String)public void append(String string)
append in interface IApimanBufferstring - String to appendIApimanBuffer.append(java.lang.String)public void append(String string, String encoding) throws UnsupportedEncodingException
append in interface IApimanBufferstring - String to appendencoding - Encoding of stringUnsupportedEncodingExceptionIApimanBuffer.append(java.lang.String, java.lang.String)public String toString(String encoding)
toString in interface IApimanBufferencoding - Encoding of stringIApimanBuffer.toString(java.lang.String)public String toString()
toString in interface IApimanBuffertoString in class ObjectObject.toString()public int getBytesInBuffer()
public int readFrom(InputStream stream) throws IOException
stream - the input stream to read fromIOException - I/O error when reading from bufferCopyright © 2015 JBoss, a division of Red Hat. All rights reserved.