org.jnetstream.capture.file.snoop
Enum SnoopPacketRecord.SnoopPacketHeader

java.lang.Object
  extended by java.lang.Enum<SnoopPacketRecord.SnoopPacketHeader>
      extended by org.jnetstream.capture.file.snoop.SnoopPacketRecord.SnoopPacketHeader
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<SnoopPacketRecord.SnoopPacketHeader>, Record.RecordHeaderField
Enclosing interface:
SnoopPacketRecord

public static enum SnoopPacketRecord.SnoopPacketHeader
extends java.lang.Enum<SnoopPacketRecord.SnoopPacketHeader>
implements Record.RecordHeaderField


Enum Constant Summary
Drops
           
IncludedLength
           
Microseconds
           
OriginalLength
           
RecordLength
           
Seconds
           
 
Field Summary
static java.nio.ByteBuffer buffer
           
static int bufferOffset
           
 
Method Summary
protected  int getLength()
           
 int getOffset()
           
<T> T
read()
          Reads the header field using the currently set debug buffer buffer.
<T> T
read(java.nio.ByteBuffer buffer)
          Gets the field value from the specified buffer using the global buffer offset of 0.
<T> T
read(java.nio.ByteBuffer buffer, int start)
          Gets the field value from the specified buffer using the global buffer offset start.
 java.lang.String toStringDebug()
          Returns a special debug string for the field.
static SnoopPacketRecord.SnoopPacketHeader valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static SnoopPacketRecord.SnoopPacketHeader[] values()
          Returns an array containing the constants of this enum type, in the order they're declared.
<T> void
write(java.nio.ByteBuffer buffer, int start, T value)
          Writes the field value from the specified buffer using the global buffer offset of start.
<T> void
write(java.nio.ByteBuffer buffer, T value)
          Writes the field value from the specified buffer using the global buffer offset of 0.
<T> void
write(T value)
          Writes the header field using the currently set debug buffer buffer.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

Drops

public static final SnoopPacketRecord.SnoopPacketHeader Drops

IncludedLength

public static final SnoopPacketRecord.SnoopPacketHeader IncludedLength

Microseconds

public static final SnoopPacketRecord.SnoopPacketHeader Microseconds

OriginalLength

public static final SnoopPacketRecord.SnoopPacketHeader OriginalLength

RecordLength

public static final SnoopPacketRecord.SnoopPacketHeader RecordLength

Seconds

public static final SnoopPacketRecord.SnoopPacketHeader Seconds
Field Detail

buffer

public static java.nio.ByteBuffer buffer

bufferOffset

public static int bufferOffset
Method Detail

values

public static final SnoopPacketRecord.SnoopPacketHeader[] values()
Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants as follows:
for(SnoopPacketRecord.SnoopPacketHeader c : SnoopPacketRecord.SnoopPacketHeader.values())
        System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they're declared

valueOf

public static SnoopPacketRecord.SnoopPacketHeader valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name

getLength

protected final int getLength()
Returns:
the length of the field

getOffset

public final int getOffset()
Returns:
Returns the offset.

read

public <T> T read()
Reads the header field using the currently set debug buffer buffer. The buffer can not be null otherwise IllegalStateException is thrown.

Specified by:
read in interface Record.RecordHeaderField
Type Parameters:
T - the return type of the field
Returns:
value of the field as read from the debug buffer

read

public <T> T read(java.nio.ByteBuffer buffer)
Gets the field value from the specified buffer using the global buffer offset of 0.

Specified by:
read in interface Record.RecordHeaderField
Type Parameters:
T - field's value type
Parameters:
buffer - buffer to read the field's value from
Returns:
field value as read from the supplied buffer

read

public <T> T read(java.nio.ByteBuffer buffer,
                  int start)
Gets the field value from the specified buffer using the global buffer offset start.

Specified by:
read in interface Record.RecordHeaderField
Type Parameters:
T - field's value type
Parameters:
buffer - buffer to read the field's value from
start - start or offset within the buffer to offset the field's value read
Returns:
field value as read from the supplied buffer

toStringDebug

public java.lang.String toStringDebug()
Returns a special debug string for the field. The returned string contains the name of the field, the field's offset within the header, the length in bits of the field and lastly uses the debug buffer with global offset of 0 to read a a value. Therefore the debug buffer must be initialized to a buffer before this method is invoked.

Specified by:
toStringDebug in interface Record.RecordHeaderField
Returns:
specially formatted string for debug output

write

public <T> void write(java.nio.ByteBuffer buffer,
                      int start,
                      T value)
Writes the field value from the specified buffer using the global buffer offset of start.

Specified by:
write in interface Record.RecordHeaderField
Type Parameters:
T - field's value type
Parameters:
buffer - buffer to write the field's value to
start - the global offset within the buffer that marks the start of the header
value - the new vlue of the field

write

public <T> void write(java.nio.ByteBuffer buffer,
                      T value)
Writes the field value from the specified buffer using the global buffer offset of 0.

Specified by:
write in interface Record.RecordHeaderField
Type Parameters:
T - field's value type
Parameters:
buffer - buffer to write the field's value to
value - the new vlue of the field

write

public <T> void write(T value)
Writes the header field using the currently set debug buffer buffer. The buffer can not be null otherwise IllegalStateException is thrown.

Specified by:
write in interface Record.RecordHeaderField
Type Parameters:
T - the value type of the field
Parameters:
value - the new value of the field