|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jnetpcap.nio.JMemory
org.jnetpcap.nio.JBuffer
public class JBuffer
A direct buffer stored in native memory.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.jnetpcap.nio.JMemory |
|---|
JMemory.Type |
| Field Summary |
|---|
| Fields inherited from class org.jnetpcap.nio.JMemory |
|---|
JNETPCAP_LIBRARY_NAME, MAX_DIRECT_MEMORY_DEFAULT, POINTER |
| Constructor Summary | |
|---|---|
JBuffer(byte[] data)
Instantiates a new j buffer. |
|
JBuffer(java.nio.ByteBuffer peer)
Instantiates a new j buffer. |
|
JBuffer(int size)
Instantiates a new j buffer. |
|
JBuffer(JMemory.Type type)
Creates a. |
|
JBuffer(JMemory peer)
Instantiates a new j buffer. |
|
| Method Summary | |
|---|---|
int |
findUTF8String(int index,
char... delimeter)
Find the delimiter array of chars within the buffer. |
byte |
getByte(int index)
Gets a signed 8-bit value. |
byte[] |
getByteArray(int index,
byte[] array)
Gets byte data from buffer and stores it in supplied array buffer. |
byte[] |
getByteArray(int index,
byte[] array,
int offset,
int length)
Reads data from JBuffer into user supplied array. |
byte[] |
getByteArray(int index,
int size)
Gets the byte data from buffer and stores into newly allocated byte array. |
double |
getDouble(int index)
Gets the java double value out of the buffer. |
float |
getFloat(int index)
Gets the java float value out of the buffer. |
int |
getInt(int index)
Gets the java signed integer value from the buffer. |
long |
getLong(int index)
Gets the java signed long value from the buffer. |
short |
getShort(int index)
Gets the java signed short value from the buffer. |
int |
getUByte(int index)
Gets the java usigned byte value. |
long |
getUInt(int index)
Gets the java usigned int value. |
int |
getUShort(int index)
Gets the java usigned short value. |
char |
getUTF8Char(int index)
Converts a single byte to a java char. |
java.lang.String |
getUTF8String(int index,
char... delimeter)
Retrieves all the characters from the buffer upto the delimiter char sequence. |
java.lang.String |
getUTF8String(int index,
int length)
Gets the specified number of characters as a string. |
java.lang.StringBuilder |
getUTF8String(int index,
java.lang.StringBuilder buf,
char... delimeter)
Retrieves all the characters from the buffer upto the delimiter char sequence. |
java.lang.StringBuilder |
getUTF8String(int index,
java.lang.StringBuilder buf,
int length)
Converts raw bytes to a java string. |
boolean |
isReadonly()
Checks if this buffer is readonly. |
java.nio.ByteOrder |
order()
Gets the byte-order of this buffer. |
void |
order(java.nio.ByteOrder order)
Sets the byte ordering of integers for this buffer. |
int |
peer(java.nio.ByteBuffer peer)
Peers this buffer with a new buffer. |
int |
peer(JBuffer peer)
Peers this buffer with the new buffer. |
int |
peer(JBuffer peer,
int offset,
int length)
Peers this buffer with a new buffer. |
int |
peer(JMemory src)
Peers this object with the supplied object. |
void |
setByte(int index,
byte value)
Sets a value in the buffer. |
void |
setByteArray(int index,
byte[] array)
Sets a value in the buffer. |
void |
setByteBuffer(int index,
java.nio.ByteBuffer data)
Sets data within this buffer. |
void |
setDouble(int index,
double value)
Sets a value in the buffer. |
void |
setFloat(int index,
float value)
Sets a value in the buffer. |
void |
setInt(int index,
int value)
Sets a value in the buffer. |
void |
setLong(int index,
long value)
Sets a value in the buffer. |
void |
setShort(int index,
short value)
Sets a value in the buffer. |
static void |
setShort0(long address,
boolean order,
int index,
short value)
Sets the short0. |
void |
setUByte(int index,
int value)
Sets a value in the buffer. |
void |
setUInt(int index,
long value)
Sets a value in the buffer. |
void |
setUShort(int index,
int value)
Sets a value in the buffer. |
int |
transferFrom(byte[] buffer)
Copies contents of the supplied buffer into this buffer. |
int |
transferFrom(java.nio.ByteBuffer src,
int dstOffset)
Copies contents of the supplied buffer into this buffer. |
int |
transferFrom(JBuffer buffer)
Copies contents of the supplied buffer into this buffer. |
int |
transferTo(java.nio.ByteBuffer dst,
int srcOffset,
int length)
Copies contents of this buffer into supplied buffer. |
int |
transferTo(JBuffer dst)
Copies the contents of this buffer into the supplied buffer. |
int |
transferTo(JBuffer dst,
int srcOffset,
int length,
int dstOffset)
Copies the contents of thsi buffer into the supplied buffer. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JBuffer(JMemory.Type type)
type - memory modelpublic JBuffer(java.nio.ByteBuffer peer)
peer - the peerpublic JBuffer(int size)
size - the sizepublic JBuffer(JMemory peer)
peer - the peerpublic JBuffer(byte[] data)
data - the data| Method Detail |
|---|
public byte getByte(int index)
index - offset into the buffer
public byte[] getByteArray(int index,
byte[] array)
index - offset into the bufferarray - byte array used to store the result where the length of the byte
array determines the number of bytes to be copied from the buffer
public byte[] getByteArray(int index,
int size)
index - offset into the buffersize - number of bytes to copy and the size of the newly allocated byte
array
public byte[] getByteArray(int index,
byte[] array,
int offset,
int length)
index - starting position in the JBufferarray - destination arrayoffset - starting position in the destination arraylength - maximum number of bytes to copy
public double getDouble(int index)
index - offset into the buffer
public float getFloat(int index)
index - offset into the buffer
public int getInt(int index)
index - offset into the buffer
public long getLong(int index)
index - offset into the buffer
public short getShort(int index)
index - offset into the buffer
public int getUByte(int index)
index - offset into the buffer
public long getUInt(int index)
index - offset into the buffer
public int getUShort(int index)
index - offset into the buffer
public int findUTF8String(int index,
char... delimeter)
index - starting offset into the bufferdelimeter - array of chars to search for
public java.lang.StringBuilder getUTF8String(int index,
java.lang.StringBuilder buf,
char... delimeter)
index - offset into the bufferbuf - string buffer where to store the string retrieved from the bufferdelimeter - array of chars which will mark the end of the string
public java.lang.String getUTF8String(int index,
char... delimeter)
index - offset into the bufferdelimeter - array of chars which will mark the end of the string
public java.lang.StringBuilder getUTF8String(int index,
java.lang.StringBuilder buf,
int length)
index - byte index into the buffer to startbuf - string buffer where the retrieved string is storedlength - number of bytes to convert
public java.lang.String getUTF8String(int index,
int length)
index - offset into the bufferlength - number of UTF8 characters to retrieve
public char getUTF8Char(int index)
index - index into the buffer
public boolean isReadonly()
public java.nio.ByteOrder order()
public void order(java.nio.ByteOrder order)
order - the new byte order for this integer
public int peer(java.nio.ByteBuffer peer)
throws PeeringException
peer in class JMemorypeer - the buffer to peer with
PeeringException - the peering exceptionByteBuffer.isDirect()public int peer(JBuffer peer)
peer - the buffer to peer with
public int peer(JBuffer peer,
int offset,
int length)
throws java.lang.IndexOutOfBoundsException
peer - buffer to peer withoffset - offset into the new peer bufferlength - number of bytes to peer
java.lang.IndexOutOfBoundsException - if offset and/or length are out of bounds
public void setByte(int index,
byte value)
index - offset into the buffervalue - new value to be stored in the buffer
public void setByteArray(int index,
byte[] array)
index - offset into the bufferarray - Array containing data to be set within the buffer. The length of
the buffer determines the number of bytes to be copied into the
buffer.
public void setDouble(int index,
double value)
index - offset into the buffervalue - new double value to be stored within the buffer
public void setFloat(int index,
float value)
index - offset into the buffervalue - new float value to be stored within the buffer
public void setInt(int index,
int value)
index - offset into the buffervalue - new int value to be stored within the buffer
public void setLong(int index,
long value)
index - offset into the buffervalue - new long value to be stored within the buffer
public void setShort(int index,
short value)
index - offset into the buffervalue - new short value to be stored within the buffer
public static void setShort0(long address,
boolean order,
int index,
short value)
address - the addressorder - the orderindex - the indexvalue - the value
public void setUByte(int index,
int value)
index - offset into the buffervalue - new usigned byte value to be stored within the buffer
public void setUInt(int index,
long value)
index - offset into the buffervalue - new usigned int value to be stored within the buffer
public void setUShort(int index,
int value)
index - offset into the buffervalue - new unsigned short value to be stored within the bufferpublic int transferFrom(byte[] buffer)
transferFrom in class JMemorybuffer - Source buffer to copy from. The array length determines the number
of bytes to copy.
public int transferFrom(java.nio.ByteBuffer src,
int dstOffset)
transferFrom in class JMemorysrc - Source buffer to copy from. The position and limit properties of
the buffer determine the bounds of the copy.dstOffset - offset into this buffer where to start the copy
public int transferFrom(JBuffer buffer)
buffer - Source buffer. The length of the source buffer determines the
number of bytes to be copied.
public int transferTo(java.nio.ByteBuffer dst,
int srcOffset,
int length)
transferTo in class JMemorydst - destination buffer where to copy data tosrcOffset - offset into this buffer where to start the copylength - number of bytes to copy
public int transferTo(JBuffer dst)
dst - Destination buffer where to copy to. The number of bytes copied is
determined by the size of source buffer.
public int transferTo(JBuffer dst,
int srcOffset,
int length,
int dstOffset)
transferTo in class JMemorydst - destination buffer where to copy tosrcOffset - offset into the source buffer where to start copy fromlength - number of bytes to copydstOffset - offset into the destination buffer where to start copy to
public void setByteBuffer(int index,
java.nio.ByteBuffer data)
index - offset into this bufferdata - data to copy into this buffer. The position and limit of the data
buffer set the bounds of the copypublic int peer(JMemory src)
peer in class JMemorysrc - source object that holds the memory location and size this object
will point to
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||