wttools.protocols.snmp
Class EncodeInBuffer

java.lang.Object
  |
  +--wttools.protocols.snmp.EncodeInBuffer
All Implemented Interfaces:
EncodeDecode, SnmpDataTypeEnumeration

public final class EncodeInBuffer
extends java.lang.Object
implements EncodeDecode, SnmpDataTypeEnumeration

EncodeInBuffer.java Created: Saturday Dec 08 2001

Version:
$Revision: 1.1 $
Author:
Kantharaj B R

Field Summary
 int MAX_LENGTH_OID
          Constant for a Maximum Length OID MAX_LENGTH_OID.
 int MORE_TO_FOLLOW
          Constant to represent more bytes in the buffer MORE_TO_FOLLOW.
 
Fields inherited from interface wttools.protocols.snmp.SnmpDataTypeEnumeration
ASN_APPLICATION, ASN_BIT_STRING, ASN_BIT8, ASN_BOOLEAN, ASN_CONSTRUCTOR, ASN_CONTEXT, ASN_EXTENSION_ID, ASN_INTEGER, ASN_LONG_LENGTH, ASN_NULL, ASN_OBJECT_ID, ASN_OCTECT_STRING, ASN_PRIMITIVE, ASN_PRIVATE, ASN_SEQUENCE, ASN_SET, ASN_UNIVERSAL, snmpDataTypeBitString, snmpDataTypeInteger, snmpDataTypeInteger32, snmpDataTypeNullObject, snmpDataTypeObjectId, snmpDataTypeOctet, snmpDataTypeUnknown, snmpString_BitString, snmpString_Integer, snmpString_Integer32, snmpString_NullObject, snmpString_ObjectId, snmpString_Octet
 
Constructor Summary
EncodeInBuffer(int length)
          EncodeInBuffer method creates the data buffer with the size of the passed length
 
Method Summary
 int bytesRequired2encodeLength(int leng)
          bytesRequired2encodeLength method evaluated the number of required to write into the buffer.
static EncodeInBuffer createBuffer(int length)
          EncodeInBuffer method creates the data buffer with the size of the passed length
 void encodeDataLength(int dataLength)
          encodeDataLength method writes the data length into the data buffer with index being pointed by the current position
 void encodeDataType(byte dataType)
          encodeDataType method writes the data type into the data buffer with index being pointed by the current position
 void encodeInteger32(int value)
          encodeInteger32 method encodes the Integer32 data type.
 void encodeObjectId(SnmpObjectIdentifier arg)
          encodeObjectId method encodes the Object Identifier
 void encodeOctet(byte[] octet)
          encodeOctet method encodes the Octet data type.
 void encodeSequence(byte type, int length)
          encodeSequence method encodes and writes the sequence of data type and length into the buffer.
 void encodeTypeLengthOfData(byte type, int leng)
          encodeTypeLengthOfData method encodes and writes the data type and the length into the buffer.
 void encodeUnsignedInteger(byte dataType, int value)
          encodeUnsignedInteger method encodes the Unsigned data type.
 void encodeVarHavingNullValue(SnmpObjectIdentifier arg)
          encodeVarHavingNullValue method encodes the Object Identifier which has the Null Value.
 byte[] getBuffer()
          getBuffer method returns the handle to the data buffer
 int getBufferLength()
          getBufferLength method returns the length of the data buffer
 int getCurrentPosition()
          getCurrentPosition method returns the index value of the data buffer
 int getNumberOfBytesLeft()
          getNumberOfBytesLeft method returns the length of the data buffer with respect to the current position of the data reference
 boolean hasData()
          hasData method checks whether the data buffer has values or not
 void reset()
          reset method resets the data reference to zero
 void setCurrentPosition(int position)
          setCurrentPosition method sets the index of the data buffer
 void setData(byte value)
          setData method writes the passed value into the data buffer with index being pointed by the current position
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_LENGTH_OID

public final int MAX_LENGTH_OID
Constant for a Maximum Length OID MAX_LENGTH_OID.

MORE_TO_FOLLOW

public final int MORE_TO_FOLLOW
Constant to represent more bytes in the buffer MORE_TO_FOLLOW.
Constructor Detail

EncodeInBuffer

public EncodeInBuffer(int length)
EncodeInBuffer method creates the data buffer with the size of the passed length
Parameters:
length - an int value
Method Detail

createBuffer

public static EncodeInBuffer createBuffer(int length)
EncodeInBuffer method creates the data buffer with the size of the passed length
Parameters:
length - an int value
Returns:
an handle to EncodeInBuffer object

reset

public void reset()
reset method resets the data reference to zero
Specified by:
reset in interface EncodeDecode
Returns:
an void

hasData

public boolean hasData()
hasData method checks whether the data buffer has values or not
Specified by:
hasData in interface EncodeDecode
Returns:
an boolean value

getBuffer

public byte[] getBuffer()
getBuffer method returns the handle to the data buffer
Specified by:
getBuffer in interface EncodeDecode
Returns:
an byte[] reference

getBufferLength

public int getBufferLength()
getBufferLength method returns the length of the data buffer
Specified by:
getBufferLength in interface EncodeDecode
Returns:
an int value

getCurrentPosition

public int getCurrentPosition()
getCurrentPosition method returns the index value of the data buffer
Specified by:
getCurrentPosition in interface EncodeDecode
Returns:
an int value

setCurrentPosition

public void setCurrentPosition(int position)
setCurrentPosition method sets the index of the data buffer
Specified by:
setCurrentPosition in interface EncodeDecode
Returns:
an void

getNumberOfBytesLeft

public int getNumberOfBytesLeft()
getNumberOfBytesLeft method returns the length of the data buffer with respect to the current position of the data reference
Specified by:
getNumberOfBytesLeft in interface EncodeDecode
Returns:
an int value

setData

public final void setData(byte value)
setData method writes the passed value into the data buffer with index being pointed by the current position
Parameters:
value - an byte value
Returns:
an void

encodeDataType

public final void encodeDataType(byte dataType)
encodeDataType method writes the data type into the data buffer with index being pointed by the current position
Parameters:
dataType - an byte value
Returns:
an void

encodeDataLength

public final void encodeDataLength(int dataLength)
encodeDataLength method writes the data length into the data buffer with index being pointed by the current position
Parameters:
dataLength - an int value
Returns:
an void

bytesRequired2encodeLength

public final int bytesRequired2encodeLength(int leng)
bytesRequired2encodeLength method evaluated the number of required to write into the buffer.
Parameters:
leng - an int value
Returns:
an int value

encodeTypeLengthOfData

public final void encodeTypeLengthOfData(byte type,
                                         int leng)
encodeTypeLengthOfData method encodes and writes the data type and the length into the buffer.
Parameters:
leng - an int value
type - an byte value
Returns:
an void

encodeSequence

public final void encodeSequence(byte type,
                                 int length)
encodeSequence method encodes and writes the sequence of data type and length into the buffer.
Parameters:
leng - an int value
type - an byte value
Returns:
an void

encodeInteger32

public final void encodeInteger32(int value)
encodeInteger32 method encodes the Integer32 data type.
Parameters:
value - an int value
Returns:
an void

encodeUnsignedInteger

public final void encodeUnsignedInteger(byte dataType,
                                        int value)
encodeUnsignedInteger method encodes the Unsigned data type.
Parameters:
value - an int value
dataType - an byte value
Returns:
an void

encodeOctet

public void encodeOctet(byte[] octet)
encodeOctet method encodes the Octet data type.
Parameters:
octet - an byte[] value
Returns:
an void

encodeObjectId

public void encodeObjectId(SnmpObjectIdentifier arg)
encodeObjectId method encodes the Object Identifier
Parameters:
arg - an SnmpObjectIdentifier value
Returns:
an void

encodeVarHavingNullValue

public void encodeVarHavingNullValue(SnmpObjectIdentifier arg)
encodeVarHavingNullValue method encodes the Object Identifier which has the Null Value.
Parameters:
arg - an SnmpObjectIdentifier value
Returns:
an void


Copyright © GNU, wttools developers Team.