com.outbackinc.services.protocol.snmp
Class Asn1InputStream

java.lang.Object
  |
  +--com.outbackinc.services.protocol.snmp.Asn1InputStream

public class Asn1InputStream
extends java.lang.Object

The Asn1InputStream takes a byte buffer and decodes it based on standard ASN.1 syntax. This class is provided for implementers of future SNMPv3 security models, otherwise it should not be normally used in JSNMP applications.

See Also:
SnmpConstants, Asn1Exception

Constructor Summary
Asn1InputStream(byte[] cbBuffer)
          Constructor.
 
Method Summary
 int getPosition()
          Get the current position in the Asn1InputStream.
 byte peekType()
          Get the ASN.1 type at the current position in the Asn1InputStream, without advancing the current position in the Asn1InputStream.
 void readException()
          Read a SnmpConstants.ASN_NOSUCHOBJECT, SnmpConstants.ASN_NOSUCHINSTANCE, or SnmpConstants.ASN_ENDOFMIBVIEW type and its ASN.1 length at the current position in the Asn1InputStream, advancing the current position in the Asn1InputStream.
 java.math.BigInteger readInteger()
          Read a SnmpConstants.ASN_INTEGER type and its ASN.1 length at the current position in the Asn1InputStream, advancing the current position in the Asn1InputStream.
 byte[] readIPAddress()
          Read a SnmpConstants.ASN_IPADDRESS type and its ASN.1 length at the current position in the Asn1InputStream, advancing the current position in the Asn1InputStream.
 int readLength()
          Get the ASN.1 length at the current position in the Asn1InputStream, advancing the current position in the Asn1InputStream.
 void readNull()
          Read a SnmpConstants.ASN_NULL type and its ASN.1 length at the current position in the Asn1InputStream, advancing the current position in the Asn1InputStream.
 byte[] readOctetString()
          Read a SnmpConstants.ASN_OCTSTR type and its ASN.1 length at the current position in the Asn1InputStream, advancing the current position in the Asn1InputStream.
 java.lang.String readOID()
          Read a SnmpConstants.ASN_OID type and its ASN.1 length at the current position in the Asn1InputStream, advancing the current position in the Asn1InputStream.
 byte[] readOpaque()
          Read a SnmpConstants.ASN_OPAQUE type and its ASN.1 length at the current position in the Asn1InputStream, advancing the current position in the Asn1InputStream.
 int readSequence()
          Read the SnmpConstants.ASN_SEQUENCE type and its ASN.1 length at the current position in the Asn1InputStream, advancing the current position in the Asn1InputStream.
 byte readType()
          Get the ASN.1 type at the current position in the Asn1InputStream, advancing the current position in the Asn1InputStream.
 java.lang.Long readUnsigned32Bit()
          Read a SnmpConstants.ASN_COUNTER, SnmpConstants.ASN_GAUGE, SnmpConstants.ASN_TIMETICKS, or SnmpConstants.ASN_UINTEGER32 type and its ASN.1 length at the current position in the Asn1InputStream, advancing the current position in the Asn1InputStream.
 java.math.BigInteger readUnsigned64Bit()
          Read a SnmpConstants.ASN_COUNTER64 type and its ASN.1 length at the current position in the Asn1InputStream, advancing the current position in the Asn1InputStream.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Asn1InputStream

public Asn1InputStream(byte[] cbBuffer)
Constructor.
Parameters:
cbBuffer - ASN.1 encoded buffer.
Method Detail

getPosition

public final int getPosition()
Get the current position in the Asn1InputStream.
Returns:
current position

peekType

public final byte peekType()
                    throws java.io.IOException
Get the ASN.1 type at the current position in the Asn1InputStream, without advancing the current position in the Asn1InputStream.
Returns:
ASN.1 type
Throws:
java.io.IOException - if current position is past end of Asn1InputStream

readType

public final byte readType()
                    throws java.io.IOException
Get the ASN.1 type at the current position in the Asn1InputStream, advancing the current position in the Asn1InputStream.
Returns:
ASN.1 type
Throws:
java.io.IOException - if current position advanced past end of Asn1InputStream

readLength

public final int readLength()
                     throws Asn1Exception,
                            java.io.IOException
Get the ASN.1 length at the current position in the Asn1InputStream, advancing the current position in the Asn1InputStream.
Returns:
ASN.1 length
Throws:
Asn1Exception - if length is greater than 4 bytes
java.io.IOException - if current position advanced past end of Asn1InputStream

readSequence

public final int readSequence()
                       throws Asn1Exception,
                              java.io.IOException
Read the SnmpConstants.ASN_SEQUENCE type and its ASN.1 length at the current position in the Asn1InputStream, advancing the current position in the Asn1InputStream.
Returns:
ASN.1 length of SnmpConstants.ASN_SEQUENCE type
Throws:
Asn1Exception - if ASN.1 type != SnmpConstants.ASN_SEQUENCE type
java.io.IOException - if current position advanced past end of Asn1InputStream
See Also:
SnmpConstants

readException

public final void readException()
                         throws Asn1Exception,
                                java.io.IOException
Read a SnmpConstants.ASN_NOSUCHOBJECT, SnmpConstants.ASN_NOSUCHINSTANCE, or SnmpConstants.ASN_ENDOFMIBVIEW type and its ASN.1 length at the current position in the Asn1InputStream, advancing the current position in the Asn1InputStream.
Throws:
Asn1Exception - if ASN.1 type != SnmpConstants.ASN_NOSUCHOBJECT, SnmpConstants.ASN_NOSUCHINSTANCE, and SnmpConstants.ASN_ENDOFMIBVIEW
java.io.IOException - if current position advanced past end of Asn1InputStream
See Also:
SnmpConstants

readNull

public final void readNull()
                    throws Asn1Exception,
                           java.io.IOException
Read a SnmpConstants.ASN_NULL type and its ASN.1 length at the current position in the Asn1InputStream, advancing the current position in the Asn1InputStream.
Throws:
Asn1Exception - if ASN.1 type != SnmpConstants.ASN_NULL
java.io.IOException - if current position advanced past end of Asn1InputStream
See Also:
SnmpConstants

readIPAddress

public final byte[] readIPAddress()
                           throws Asn1Exception,
                                  java.io.IOException
Read a SnmpConstants.ASN_IPADDRESS type and its ASN.1 length at the current position in the Asn1InputStream, advancing the current position in the Asn1InputStream.
Returns:
ipAddress
Throws:
Asn1Exception - if ASN.1 type != SnmpConstants.ASN_IPADDRESS
java.io.IOException - if current position advanced past end of Asn1InputStream
See Also:
SnmpConstants

readOpaque

public final byte[] readOpaque()
                        throws Asn1Exception,
                               java.io.IOException
Read a SnmpConstants.ASN_OPAQUE type and its ASN.1 length at the current position in the Asn1InputStream, advancing the current position in the Asn1InputStream.
Returns:
opaque
Throws:
Asn1Exception - if ASN.1 type != SnmpConstants.ASN_OPAQUE
java.io.IOException - if current position advanced past end of Asn1InputStream
See Also:
SnmpConstants

readUnsigned32Bit

public final java.lang.Long readUnsigned32Bit()
                                       throws Asn1Exception,
                                              java.io.IOException
Read a SnmpConstants.ASN_COUNTER, SnmpConstants.ASN_GAUGE, SnmpConstants.ASN_TIMETICKS, or SnmpConstants.ASN_UINTEGER32 type and its ASN.1 length at the current position in the Asn1InputStream, advancing the current position in the Asn1InputStream.
Returns:
SnmpConstants.ASN_COUNTER, SnmpConstants.ASN_GAUGE, SnmpConstants.ASN_TIMETICKS, or SnmpConstants.ASN_UINTEGER32 value
Throws:
Asn1Exception - if ASN.1 type != SnmpConstants.ASN_COUNTER, SnmpConstants.ASN_GAUGE, SnmpConstants.ASN_TIMETICKS, and SnmpConstants.ASN_UINTEGER32
java.io.IOException - if current position advanced past end of Asn1InputStream
See Also:
SnmpConstants

readUnsigned64Bit

public final java.math.BigInteger readUnsigned64Bit()
                                             throws Asn1Exception,
                                                    java.io.IOException
Read a SnmpConstants.ASN_COUNTER64 type and its ASN.1 length at the current position in the Asn1InputStream, advancing the current position in the Asn1InputStream.
Returns:
SnmpConstants.ASN_COUNTER64 value
Throws:
Asn1Exception - if ASN.1 type != SnmpConstants.ASN_COUNTER64
java.io.IOException - if current position advanced past end of Asn1InputStream
See Also:
SnmpConstants

readInteger

public final java.math.BigInteger readInteger()
                                       throws Asn1Exception,
                                              java.io.IOException
Read a SnmpConstants.ASN_INTEGER type and its ASN.1 length at the current position in the Asn1InputStream, advancing the current position in the Asn1InputStream.
Returns:
SnmpConstants.ASN_INTEGER value
Throws:
Asn1Exception - if ASN.1 type != SnmpConstants.ASN_INTEGER
java.io.IOException - if current position advanced past end of Asn1InputStream
See Also:
SnmpConstants

readOID

public final java.lang.String readOID()
                               throws Asn1Exception,
                                      java.io.IOException
Read a SnmpConstants.ASN_OID type and its ASN.1 length at the current position in the Asn1InputStream, advancing the current position in the Asn1InputStream.
Returns:
OID
Throws:
Asn1Exception - if ASN.1 type != SnmpConstants.ASN_OID
java.io.IOException - if current position advanced past end of Asn1InputStream
See Also:
SnmpConstants

readOctetString

public final byte[] readOctetString()
                             throws Asn1Exception,
                                    java.io.IOException
Read a SnmpConstants.ASN_OCTSTR type and its ASN.1 length at the current position in the Asn1InputStream, advancing the current position in the Asn1InputStream.
Returns:
octet
Throws:
Asn1Exception - if ASN.1 type != SnmpConstants.ASN_OCTSTR
java.io.IOException - if current position advanced past end of Asn1InputStream
See Also:
SnmpConstants


Home  Services  Products  Purchase  Contact Us  About Us  Legal  Ceramics
Copyright © 2003-2008 jSNMP Enterprises All rights reserved.