org.jnetpcap.util
Class SlidingBuffer

java.lang.Object
  extended by org.jnetpcap.util.SlidingBuffer

public class SlidingBuffer
extends java.lang.Object

The Class SlidingBuffer.

Author:
Mark Bednarczyk, Sly Technologies, Inc.

Constructor Summary
SlidingBuffer(int size)
          Instantiates a new sliding buffer.
 
Method Summary
 int findUTF8String(long sequence, char... delimeter)
          Find ut f8 string.
 byte getByte(long sequence)
          Gets the byte.
 byte[] getByteArray(long sequence, byte[] array)
          Gets the byte array.
 byte[] getByteArray(long sequence, int size)
          Gets the byte array.
 double getDouble(long sequence)
          Gets the double.
 float getFloat(long sequence)
          Gets the float.
 int getInt(long sequence)
          Gets the int.
 long getLong(long sequence)
          Gets the long.
 short getShort(long sequence)
          Gets the short.
 int getUByte(long sequence)
          Gets the u byte.
 long getUInt(long sequence)
          Gets the u int.
 int getUShort(long sequence)
          Gets the u short.
 char getUTF8Char(long sequence)
          Gets the uT f8 char.
 java.lang.StringBuilder getUTF8String(int sequence, java.lang.StringBuilder buf, char... delimeter)
          Gets the uT f8 string.
 java.lang.String getUTF8String(long sequence, char... delimeter)
          Gets the uT f8 string.
 java.lang.String getUTF8String(long sequence, int length)
          Gets the uT f8 string.
 java.lang.StringBuilder getUTF8String(long sequence, java.lang.StringBuilder buf, int length)
          Gets the uT f8 string.
 int hashCode()
          Hash code.
 boolean isInitialized()
          Checks if is initialized.
 boolean isJMemoryBasedOwner()
          Checks if is j memory based owner.
 boolean isOwner()
          Checks if is owner.
 boolean isReadonly()
          Checks if is readonly.
 int length()
          Length.
 java.nio.ByteOrder order()
          Order.
 void order(java.nio.ByteOrder order)
          Order.
 int peer(java.nio.ByteBuffer peer)
          Peer.
 int peer(JBuffer peer)
          Peer.
 int peer(JBuffer peer, int offset, int length)
          Peer.
 int peer(JMemory src)
          Peer.
 void setByte(long sequence, byte value)
          Sets the byte.
 void setByteArray(long sequence, byte[] array)
          Sets the byte array.
 void setByteBuffer(int i, java.nio.ByteBuffer data)
          Sets the byte buffer.
 void setDouble(long sequence, double value)
          Sets the double.
 void setFloat(long sequence, float value)
          Sets the float.
 void setInt(long sequence, int value)
          Sets the int.
 void setLong(long sequence, long value)
          Sets the long.
 void setShort(long sequence, short value)
          Sets the short.
 void setUByte(long sequence, int value)
          Sets the u byte.
 void setUInt(long sequence, long value)
          Sets the u int.
 void setUShort(long sequence, int value)
          Sets the u short.
 java.lang.String toDebugString()
          To debug string.
 java.lang.String toHexdump()
          To hexdump.
 java.lang.String toHexdump(int length, boolean address, boolean text, boolean data)
          To hexdump.
 java.lang.String toString()
          To string.
 int transferFrom(byte[] buffer)
          Transfer from.
 int transferFrom(java.nio.ByteBuffer src, int dstOffset)
          Transfer from.
 int transferFrom(JBuffer buffer)
          Transfer from.
 int transferTo(java.nio.ByteBuffer dst)
          Transfer to.
 int transferTo(java.nio.ByteBuffer dst, int srcOffset, int length)
          Transfer to.
 int transferTo(JBuffer dst)
          Transfer to.
 int transferTo(JBuffer dst, int srcOffset, int length, int dstOffset)
          Transfer to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SlidingBuffer

public SlidingBuffer(int size)
Instantiates a new sliding buffer.

Parameters:
size - the size
Method Detail

findUTF8String

public int findUTF8String(long sequence,
                          char... delimeter)
Find ut f8 string.

Parameters:
sequence - the sequence
delimeter - the delimeter
Returns:
the int

getByte

public byte getByte(long sequence)
Gets the byte.

Parameters:
sequence - the sequence
Returns:
the byte

getByteArray

public byte[] getByteArray(long sequence,
                           byte[] array)
Gets the byte array.

Parameters:
sequence - the sequence
array - the array
Returns:
the byte array

getByteArray

public byte[] getByteArray(long sequence,
                           int size)
Gets the byte array.

Parameters:
sequence - the sequence
size - the size
Returns:
the byte array

getDouble

public double getDouble(long sequence)
Gets the double.

Parameters:
sequence - the sequence
Returns:
the double

getFloat

public float getFloat(long sequence)
Gets the float.

Parameters:
sequence - the sequence
Returns:
the float

getInt

public int getInt(long sequence)
Gets the int.

Parameters:
sequence - the sequence
Returns:
the int

getLong

public long getLong(long sequence)
Gets the long.

Parameters:
sequence - the sequence
Returns:
the long

getShort

public short getShort(long sequence)
Gets the short.

Parameters:
sequence - the sequence
Returns:
the short

getUByte

public int getUByte(long sequence)
Gets the u byte.

Parameters:
sequence - the sequence
Returns:
the u byte

getUInt

public long getUInt(long sequence)
Gets the u int.

Parameters:
sequence - the sequence
Returns:
the u int

getUShort

public int getUShort(long sequence)
Gets the u short.

Parameters:
sequence - the sequence
Returns:
the u short

getUTF8Char

public char getUTF8Char(long sequence)
Gets the uT f8 char.

Parameters:
sequence - the sequence
Returns:
the uT f8 char

getUTF8String

public java.lang.String getUTF8String(long sequence,
                                      char... delimeter)
Gets the uT f8 string.

Parameters:
sequence - the sequence
delimeter - the delimeter
Returns:
the uT f8 string

getUTF8String

public java.lang.String getUTF8String(long sequence,
                                      int length)
Gets the uT f8 string.

Parameters:
sequence - the sequence
length - the length
Returns:
the uT f8 string

getUTF8String

public java.lang.StringBuilder getUTF8String(int sequence,
                                             java.lang.StringBuilder buf,
                                             char... delimeter)
Gets the uT f8 string.

Parameters:
sequence - the sequence
buf - the buf
delimeter - the delimeter
Returns:
the uT f8 string

getUTF8String

public java.lang.StringBuilder getUTF8String(long sequence,
                                             java.lang.StringBuilder buf,
                                             int length)
Gets the uT f8 string.

Parameters:
sequence - the sequence
buf - the buf
length - the length
Returns:
the uT f8 string

hashCode

public int hashCode()
Hash code.

Overrides:
hashCode in class java.lang.Object
Returns:
the int
See Also:
Object.hashCode()

isInitialized

public boolean isInitialized()
Checks if is initialized.

Returns:
true, if is initialized

isJMemoryBasedOwner

public boolean isJMemoryBasedOwner()
Checks if is j memory based owner.

Returns:
true, if is j memory based owner

isOwner

public final boolean isOwner()
Checks if is owner.

Returns:
true, if is owner

isReadonly

public boolean isReadonly()
Checks if is readonly.

Returns:
true, if is readonly

order

public java.nio.ByteOrder order()
Order.

Returns:
the byte order

order

public void order(java.nio.ByteOrder order)
Order.

Parameters:
order - the order

peer

public int peer(java.nio.ByteBuffer peer)
         throws PeeringException
Peer.

Parameters:
peer - the peer
Returns:
the int
Throws:
PeeringException - the peering exception

peer

public int peer(JBuffer peer,
                int offset,
                int length)
         throws java.lang.IndexOutOfBoundsException
Peer.

Parameters:
peer - the peer
offset - the offset
length - the length
Returns:
the int
Throws:
java.lang.IndexOutOfBoundsException - the index out of bounds exception

peer

public int peer(JBuffer peer)
Peer.

Parameters:
peer - the peer
Returns:
the int

peer

public int peer(JMemory src)
Peer.

Parameters:
src - the src
Returns:
the int

setByte

public void setByte(long sequence,
                    byte value)
Sets the byte.

Parameters:
sequence - the sequence
value - the value

setByteArray

public void setByteArray(long sequence,
                         byte[] array)
Sets the byte array.

Parameters:
sequence - the sequence
array - the array

setByteBuffer

public void setByteBuffer(int i,
                          java.nio.ByteBuffer data)
Sets the byte buffer.

Parameters:
i - the i
data - the data

setDouble

public void setDouble(long sequence,
                      double value)
Sets the double.

Parameters:
sequence - the sequence
value - the value

setFloat

public void setFloat(long sequence,
                     float value)
Sets the float.

Parameters:
sequence - the sequence
value - the value

setInt

public void setInt(long sequence,
                   int value)
Sets the int.

Parameters:
sequence - the sequence
value - the value

setLong

public void setLong(long sequence,
                    long value)
Sets the long.

Parameters:
sequence - the sequence
value - the value

setShort

public void setShort(long sequence,
                     short value)
Sets the short.

Parameters:
sequence - the sequence
value - the value

setUByte

public void setUByte(long sequence,
                     int value)
Sets the u byte.

Parameters:
sequence - the sequence
value - the value

setUInt

public void setUInt(long sequence,
                    long value)
Sets the u int.

Parameters:
sequence - the sequence
value - the value

setUShort

public void setUShort(long sequence,
                      int value)
Sets the u short.

Parameters:
sequence - the sequence
value - the value

length

public int length()
Length.

Returns:
the int

toDebugString

public java.lang.String toDebugString()
To debug string.

Returns:
the string

toHexdump

public java.lang.String toHexdump()
To hexdump.

Returns:
the string

toHexdump

public java.lang.String toHexdump(int length,
                                  boolean address,
                                  boolean text,
                                  boolean data)
To hexdump.

Parameters:
length - the length
address - the address
text - the text
data - the data
Returns:
the string

toString

public java.lang.String toString()
To string.

Overrides:
toString in class java.lang.Object
Returns:
the string
See Also:
Object.toString()

transferFrom

public int transferFrom(byte[] buffer)
Transfer from.

Parameters:
buffer - the buffer
Returns:
the int

transferFrom

public int transferFrom(java.nio.ByteBuffer src,
                        int dstOffset)
Transfer from.

Parameters:
src - the src
dstOffset - the dst offset
Returns:
the int

transferFrom

public int transferFrom(JBuffer buffer)
Transfer from.

Parameters:
buffer - the buffer
Returns:
the int

transferTo

public int transferTo(java.nio.ByteBuffer dst,
                      int srcOffset,
                      int length)
Transfer to.

Parameters:
dst - the dst
srcOffset - the src offset
length - the length
Returns:
the int

transferTo

public int transferTo(java.nio.ByteBuffer dst)
Transfer to.

Parameters:
dst - the dst
Returns:
the int

transferTo

public int transferTo(JBuffer dst,
                      int srcOffset,
                      int length,
                      int dstOffset)
Transfer to.

Parameters:
dst - the dst
srcOffset - the src offset
length - the length
dstOffset - the dst offset
Returns:
the int

transferTo

public int transferTo(JBuffer dst)
Transfer to.

Parameters:
dst - the dst
Returns:
the int