com.neeve.pkt
Class PktConstants

java.lang.Object
  extended by com.neeve.pkt.PktConstants

public final class PktConstants
extends Object

Class containing package wide constant definitions.

This class contains constant definitions for use by this package.


Field Summary
static int DESERIALIZE_POLICY_DEFAULT
          Deserialization policy - Use default.
static int DESERIALIZE_POLICY_HEADER_COPY_BODY_COPY
          Deserialization policy - Copy both the packet header and body.
static int DESERIALIZE_POLICY_HEADER_COPY_BODY_SLICE
          Deserialization policy - Copy packet header, slice packet body.
static int DESERIALIZE_POLICY_HEADER_SLICE_BODY_SLICE
          Derialization policy - Slice packet header, slice packet body.
static int SERIALIZE_POLICY_DEFAULT
          Serialization policy - Use default.
static int SERIALIZE_POLICY_HEADER_ATTACH_BODY_ATTACH
          Serialization policy - Attach packet header, attach packet body.
static int SERIALIZE_POLICY_HEADER_COPY_BODY_ATTACH
          Serialization policy - Copy packet header, attach packet body.
static int SERIALIZE_POLICY_HEADER_COPY_BODY_COPY
          Serialization policy - Copy both the packet header and body.
 
Constructor Summary
PktConstants()
           
 
Method Summary
static int deserializationPolicyFromStr(String policyStr)
          Gets a deserialization policy from a string
static String deserializationPolicyToStr(int policy)
          Gets a string representation of a deserialization policy
static int serializationPolicyFromStr(String policyStr)
          Gets a serialization policy from a string
static String serializationPolicyToStr(int policy)
          Gets a string representation of a serialization policy
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERIALIZE_POLICY_DEFAULT

public static final int SERIALIZE_POLICY_DEFAULT
Serialization policy - Use default.

This serialization policy is used to specify to the serialization method to use the serialization policy set for the packet type or packet i.e. the caller does not wish to override what has been configured for the packet type or packet

See Also:
Constant Field Values

SERIALIZE_POLICY_HEADER_COPY_BODY_COPY

public static final int SERIALIZE_POLICY_HEADER_COPY_BODY_COPY
Serialization policy - Copy both the packet header and body.

This serialiation policy causes the packet to serialize its contents to the space remaining in the last buffer in the buffer list provided by the user to the PktPacket.serialize(com.neeve.pkt.PktSerializable.SerializeContext, com.neeve.trace.Tracer) method. If insufficient space remains in the last buffer to accomodate the entire packet, a new buffer is allocated of the same size as the last buffer in the list and the overlow data is copied to that buffer. With this serialization mode, there can be atmost one additional buffer in the list upon return from th serialization method

See Also:
Constant Field Values

SERIALIZE_POLICY_HEADER_COPY_BODY_ATTACH

public static final int SERIALIZE_POLICY_HEADER_COPY_BODY_ATTACH
Serialization policy - Copy packet header, attach packet body.

This serialiation policy causes the packet to serialize its packet header (including any subheaders) contents to the space remaining in the last buffer in the buffer list provided by the user to the PktPacket.serialize(com.neeve.pkt.PktSerializable.SerializeContext, com.neeve.trace.Tracer) method. If insufficient space remains in the last buffer to accomodate the entire header, a new buffer is allocated of size equal to the length of the overlow data and the overlow data is copied to that buffer. The packet body internal buffers are then appended to the buffer list. With this serialization mode, there can be several additional buffers in the list upon return from the serialization method.

See Also:
Constant Field Values

SERIALIZE_POLICY_HEADER_ATTACH_BODY_ATTACH

public static final int SERIALIZE_POLICY_HEADER_ATTACH_BODY_ATTACH
Serialization policy - Attach packet header, attach packet body.

This serialiation policy causes the packet header and body internal buffers to be appended to the buffer list provided by the caller to the PktPacket.serialize(com.neeve.pkt.PktSerializable.SerializeContext, com.neeve.trace.Tracer) method. With this serialization mode, there can be several additional buffers in the list upon return from the serialization method.

See Also:
Constant Field Values

DESERIALIZE_POLICY_DEFAULT

public static final int DESERIALIZE_POLICY_DEFAULT
Deserialization policy - Use default.

This deserialization policy is used to specify to the deserialization method to use the deserialization policy set for the packet type or packet i.e. the caller does not wish to override what has been configured for the packet type or packet

See Also:
Constant Field Values

DESERIALIZE_POLICY_HEADER_COPY_BODY_COPY

public static final int DESERIALIZE_POLICY_HEADER_COPY_BODY_COPY
Deserialization policy - Copy both the packet header and body.

This deserialiation policy causes the packet to deserialize its contents by copying the header and body data from byte array provided by the user to the deserialize method. Upon return from the deserialize method, the user is free to reuse any of the buffers passed in to the deserialization method.

See Also:
Constant Field Values

DESERIALIZE_POLICY_HEADER_COPY_BODY_SLICE

public static final int DESERIALIZE_POLICY_HEADER_COPY_BODY_SLICE
Deserialization policy - Copy packet header, slice packet body.

This deserialiation policy causes the packet to deserialize its contents by copying only the header contents from the byte array provided by the user to the deserialize method. The body contents are deserialized by slicing the byte array (marking out a portion of tha array and holding a reference to that portion). Upon return from the deserialize method, the user cannot reuse any of the buffers passed in to the deserialization method that were used in the deserialization process since portion of those buffers are in use subsequent to returning from the deserialization process.

See Also:
Constant Field Values

DESERIALIZE_POLICY_HEADER_SLICE_BODY_SLICE

public static final int DESERIALIZE_POLICY_HEADER_SLICE_BODY_SLICE
Derialization policy - Slice packet header, slice packet body.

This deserialiation policy causes the packet to deserialize its contents slicing the byte array (marking out a portion of tha array and holding a reference to that portion) for both the header and the body contents. Upon return from the deserialize method, the user cannot reuse any of the buffers passed in to the deserialization method that were used in the deserialization process since portion of those buffers are in use subsequent to returning from the deserialization process.

See Also:
Constant Field Values
Constructor Detail

PktConstants

public PktConstants()
Method Detail

serializationPolicyToStr

public static String serializationPolicyToStr(int policy)
Gets a string representation of a serialization policy

Throws:
IllegalArgumentException - in case an invalid policy is specified

serializationPolicyFromStr

public static int serializationPolicyFromStr(String policyStr)
Gets a serialization policy from a string

Throws:
IllegalArgumentException - in case an invalid policy string is specified

deserializationPolicyToStr

public static String deserializationPolicyToStr(int policy)
Gets a string representation of a deserialization policy

Throws:
IllegalArgumentException - in case an invalid policy is specified

deserializationPolicyFromStr

public static int deserializationPolicyFromStr(String policyStr)
Gets a deserialization policy from a string

Throws:
IllegalArgumentException - in case an invalid policy string is specified


Copyright © 2016 Neeve Research, LLC. All Rights Reserved.