Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javax.management.snmp
Class BerDecoder

    java.lang.Object
      javax.management.snmp.BerDecoder

Deprecated. Use package `com.sun.management.snmp` in preference to classes in this package. This class may be removed in a future version of Java DMK.

public class BerDecoder
extends Object

The `BerDecoder` class is used for decoding BER-encoded data. A `BerDecoder` needs to be set up with the byte string containing the encoding. It maintains a current position in the byte string. Methods allows to fetch integer, string, OID, etc., from the current position. After a fetch the current position is moved forward. A fetch throws a `BerException` if the encoding is not of the expected type.

Since:
  Java DMK 5.0
Version:
  4.18 11/17/06
Author:
  Sun Microsystems, Inc

Field Summary
`static int` | `BooleanTag` Deprecated.
`static int` | `IntegerTag` Deprecated.
`static int` | `NullTag` Deprecated.
`static int` | `OctetStringTag` Deprecated.
`static int` | `OidTag` Deprecated.
`static int` | `SequenceTag` Deprecated.

Constructor Summary
`BerDecoder(byte[] b)` Deprecated. Constructs a new decoder and attaches it to the specified byte string.

Method Summary
`boolean` | `cannotCloseSequence()` Deprecated. Return `true` if the end of the current sequence is not reached.
`void` | `closeSequence()` Deprecated. Close a sequence.
`byte[]` | `fetchAny()` Deprecated. Fetch an `ANY` value.
`byte[]` | `fetchAny(int tag)` Deprecated. Fetch an `ANY` value with a specific tag.
`int` | `fetchInteger()` Deprecated. Fetch an integer.
`int` | `fetchInteger(int tag)` Deprecated. Fetch an integer with the specified tag.
`long` | `fetchIntegerAsLong()` Deprecated. Fetch an integer and return a long value.
`long` | `fetchIntegerAsLong(int tag)` Deprecated. Fetch an integer with the specified tag and return a long value.
`void` | `fetchNull()` Deprecated. Fetch a `NULL` value.
`void` | `fetchNull(int tag)` Deprecated. Fetch a `NULL` value with a specified tag.
`byte[]` | `fetchOctetString()` Deprecated. Fetch an octet string.
`byte[]` | `fetchOctetString(int tag)` Deprecated. Fetch an octet string with a specified tag.
`long[]` | `fetchOid()` Deprecated. Fetch an object identifier.
`long[]` | `fetchOid(int tag)` Deprecated. Fetch an object identifier with a specified tag.
`int` | `getTag()` Deprecated. Get the tag of the data at the current position.
`void` | `openSequence()` Deprecated. Fetch a sequence header.
`void` | `openSequence(int tag)` Deprecated. Fetch a sequence header with a specific tag.
`void` | `reset()` Deprecated.
`String` | `toString()` Deprecated.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### BooleanTag

    public static final int BooleanTag

  Deprecated.
  See Also:
    Constant Field Values

### IntegerTag

    public static final int IntegerTag

  Deprecated.
  See Also:
    Constant Field Values

### OctetStringTag

    public static final int OctetStringTag

  Deprecated.
  See Also:
    Constant Field Values

### NullTag

    public static final int NullTag

  Deprecated.
  See Also:
    Constant Field Values

### OidTag

    public static final int OidTag

  Deprecated.
  See Also:
    Constant Field Values

### SequenceTag

    public static final int SequenceTag

  Deprecated.
  See Also:
    Constant Field Values

Constructor Detail

### BerDecoder

    public BerDecoder(byte[] b)

  Deprecated.
  Constructs a new decoder and attaches it to the specified byte string.

Parameters:
  `b` - The byte string containing the encoded data.

Method Detail

### reset

    public void reset()

  Deprecated.

### fetchInteger

    public int fetchInteger()
                     throws BerException

  Deprecated.
  Fetch an integer.

  Returns:
    The decoded integer.
  Throws:
    `BerException` - Current position does not point to an integer.

### fetchInteger

    public int fetchInteger(int tag)
                     throws BerException

  Deprecated.
  Fetch an integer with the specified tag.

  Parameters:
    `tag` - The expected tag.
  Returns:
    The decoded integer.
  Throws:
    `BerException` - Current position does not point to an integer or the tag is not the expected one.

### fetchIntegerAsLong

    public long fetchIntegerAsLong()
                            throws BerException

  Deprecated.
  Fetch an integer and return a long value.

  Returns:
    The decoded integer.
  Throws:
    `BerException` - Current position does not point to an integer.

### fetchIntegerAsLong

    public long fetchIntegerAsLong(int tag)
                            throws BerException

  Deprecated.
  Fetch an integer with the specified tag and return a long value.

  Parameters:
    `tag` - The expected tag.
  Returns:
    The decoded integer.
  Throws:
    `BerException` - Current position does not point to an integer or the tag is not the expected one.

### fetchOctetString

    public byte[] fetchOctetString()
                            throws BerException

  Deprecated.
  Fetch an octet string.

  Returns:
    The decoded string.
  Throws:
    `BerException` - Current position does not point to an octet string.

### fetchOctetString

    public byte[] fetchOctetString(int tag)
                            throws BerException

  Deprecated.
  Fetch an octet string with a specified tag.

  Parameters:
    `tag` - The expected tag.
  Returns:
    The decoded string.
  Throws:
    `BerException` - Current position does not point to an octet string or the tag is not the expected one.

### fetchOid

    public long[] fetchOid()
                    throws BerException

  Deprecated.
  Fetch an object identifier.

  Returns:
    The decoded object identifier as an array of long.
  Throws:
    `BerException`

### fetchOid

    public long[] fetchOid(int tag)
                    throws BerException

  Deprecated.
  Fetch an object identifier with a specified tag.

  Parameters:
    `tag` - The expected tag.
  Returns:
    The decoded object identifier as an array of long.
  Throws:
    `BerException` - Current position does not point to an oid or the tag is not the expected one.

### fetchNull

    public void fetchNull()
                   throws BerException

  Deprecated.
  Fetch a `NULL` value.

  Throws:
    `BerException` - Current position does not point to `NULL` value.

### fetchNull

    public void fetchNull(int tag)
                   throws BerException

  Deprecated.
  Fetch a `NULL` value with a specified tag.

  Parameters:
    `tag` - The expected tag.
  Throws:
    `BerException` - Current position does not point to `NULL` value or the tag is not the expected one.

### fetchAny

    public byte[] fetchAny()
                    throws BerException

  Deprecated.
  Fetch an `ANY` value. In fact, this method does not decode anything it simply returns the next TLV as an array of bytes.

  Returns:
    The TLV as a byte array.
  Throws:
    `BerException` - The next TLV is really badly encoded...

### fetchAny

    public byte[] fetchAny(int tag)
                    throws BerException

  Deprecated.
  Fetch an `ANY` value with a specific tag.

  Parameters:
    `tag` - The expected tag.
  Returns:
    The TLV as a byte array.
  Throws:
    `BerException` - The next TLV is really badly encoded...

### openSequence

    public void openSequence()
                      throws BerException

  Deprecated.
  Fetch a sequence header. The decoder computes the end position of the sequence and push it on its stack.

  Throws:
    `BerException` - Current position does not point to a sequence header.

### openSequence

    public void openSequence(int tag)
                      throws BerException

  Deprecated.
  Fetch a sequence header with a specific tag.

  Parameters:
    `tag` - The expected tag.
  Throws:
    `BerException` - Current position does not point to a sequence header or the tag is not the expected one.

### closeSequence

    public void closeSequence()
                       throws BerException

  Deprecated.
  Close a sequence. The decode pull the stack and verifies that the current position matches with the calculated end of the sequence. If not it throws an exception.

  Throws:
    `BerException` - The sequence is not expected to finish here.

### cannotCloseSequence

    public boolean cannotCloseSequence()

  Deprecated.
  Return `true` if the end of the current sequence is not reached. When this method returns `false`, `closeSequence` can (and must) be invoked.

  Returns:
    `true` if there is still some data in the sequence.

### getTag

    public int getTag()
               throws BerException

  Deprecated.
  Get the tag of the data at the current position. Current position is unchanged.

  Returns:
    The next tag.
  Throws:
    `BerException`

### toString

    public String toString()

  Deprecated.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| FCS Release jdmk-5_1-b34.3 2007.01.18_18:11:52_MET
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.