wttools.protocols.snmp
Class DecodeFromBuffer

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

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

DecodeFromBuffer.java Created: Saturday Dec 08 2001

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

Field Summary
static int MAX_LENGTH_OID
          Constant for a Maximum Length OID MAX_LENGTH_OID.
static int SIXFOURKB
          Constant to represent the 64KB value SIXFOURKB.
 
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
DecodeFromBuffer(byte[] sourceBuffer)
          DecodeFromBuffer method performs decoding of the passed data buffer.
DecodeFromBuffer(byte[] sourceBuffer, int sourceBufferLength)
          DecodeFromBuffer method performs decoding of the passed data buffer for a specified amount of the length.
 
Method Summary
 byte decodeDataType()
          decodeDataType method checks whether the data type is supported or not.
 int decodeLengthOfData()
          decodeLengthOfData method decodes the Length of the data buffer.
 int[] decodeObjectId()
          decodeObjectId method decodes the Object Identifier data type
 byte[] decodeOctet()
          decodeOctet method decodes the Octet data type.
 byte[] getBuffer()
          hasData method checks whether the data variable has data in it or not.
 int getBufferLength()
          getBufferLength method returns the Length of the data buffer.
 int getCurrentPosition()
          getCurrentPosition method returns the reference to the current byte position in the data array.
 int getNumberOfBytesLeft()
          getNumberOfBytesLeft method returns the number of bytes left in array to be processed from the reference to the data buffer.
 boolean hasData()
          hasData method checks whether the data variable has data in it or not.
 void reset()
          reset method resets the reference.
 void setCurrentPosition(int position)
          setCurrentPosition method sets the reference to the specified byte in the data buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_LENGTH_OID

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

SIXFOURKB

public static final int SIXFOURKB
Constant to represent the 64KB value SIXFOURKB.
Constructor Detail

DecodeFromBuffer

public DecodeFromBuffer(byte[] sourceBuffer)
DecodeFromBuffer method performs decoding of the passed data buffer.
Parameters:
sourceBuffer - an byte[] value

DecodeFromBuffer

public DecodeFromBuffer(byte[] sourceBuffer,
                        int sourceBufferLength)
DecodeFromBuffer method performs decoding of the passed data buffer for a specified amount of the length.
Parameters:
sourceBuffer - an byte[] value
sourceBufferLength - an int value
Method Detail

reset

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

hasData

public boolean hasData()
hasData method checks whether the data variable has data in it or not.
Specified by:
hasData in interface EncodeDecode
Returns:
an boolean

getBuffer

public byte[] getBuffer()
hasData method checks whether the data variable has data in it or not.
Specified by:
getBuffer in interface EncodeDecode
Returns:
an boolean

getBufferLength

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

getCurrentPosition

public int getCurrentPosition()
getCurrentPosition method returns the reference to the current byte position in the data array.
Specified by:
getCurrentPosition in interface EncodeDecode
Returns:
an int

setCurrentPosition

public void setCurrentPosition(int position)
setCurrentPosition method sets the reference to the specified byte in the data buffer.
Specified by:
setCurrentPosition in interface EncodeDecode
Parameters:
position - an int value
Returns:
an void

getNumberOfBytesLeft

public int getNumberOfBytesLeft()
getNumberOfBytesLeft method returns the number of bytes left in array to be processed from the reference to the data buffer.
Specified by:
getNumberOfBytesLeft in interface EncodeDecode
Returns:
an int

decodeDataType

public final byte decodeDataType()
                          throws wttools.protocols.snmp.SnmpException
decodeDataType method checks whether the data type is supported or not.
Returns:
an byte
Throws:
wttools.protocols.snmp.SnmpException - if an data type is not supported

decodeLengthOfData

public final int decodeLengthOfData()
                             throws wttools.protocols.snmp.SnmpException
decodeLengthOfData method decodes the Length of the data buffer.
Returns:
an int
Throws:
wttools.protocols.snmp.SnmpException - if the Data Length is not supported

decodeOctet

public byte[] decodeOctet()
                   throws wttools.protocols.snmp.SnmpException
decodeOctet method decodes the Octet data type.
Returns:
an byte[]
Throws:
wttools.protocols.snmp.SnmpException - if the passed data is not of type Octet

decodeObjectId

public int[] decodeObjectId()
                     throws wttools.protocols.snmp.SnmpException
decodeObjectId method decodes the Object Identifier data type
Returns:
an int[]
Throws:
wttools.protocols.snmp.SnmpException - if the passed data is not of type OID


Copyright GNU, wttools developers Team.