javax.management.snmp
Class BerEncoder

java.lang.Object
  extended byjavax.management.snmp.BerEncoder

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 BerEncoder
extends Object

The BerEncoder class is used for encoding data using BER. A BerEncoder needs to be set up with a byte buffer. The encoded data are stored in this byte buffer.

NOTE : the buffer is filled from end to start. This means the caller needs to encode its data in the reverse order.

Since:
Java DMK 5.0
Version:
4.14 04/15/04
Author:
Sun Microsystems, Inc

Field Summary
static int BooleanTag
          Deprecated.  
protected  byte[] bytes
          Deprecated.  
static int IntegerTag
          Deprecated.  
static int NullTag
          Deprecated.  
static int OctetStringTag
          Deprecated.  
static int OidTag
          Deprecated.  
static int SequenceTag
          Deprecated.  
protected  int[] stackBuf
          Deprecated.  
protected  int stackTop
          Deprecated.  
protected  int start
          Deprecated.  
 
Constructor Summary
BerEncoder(byte[] b)
          Deprecated. Constructs a new encoder and attaches it to the specified byte string.
 
Method Summary
 void closeSequence()
          Deprecated. Close a sequence.
 void closeSequence(int tag)
          Deprecated. Close a sequence with the specified tag.
 void openSequence()
          Deprecated. Open a sequence.
 void putAny(byte[] s)
          Deprecated. Put an ANY value.
 void putAny(byte[] s, int byteCount)
          Deprecated. Put an ANY value.
 void putInteger(int v)
          Deprecated. Put an integer.
 void putInteger(int v, int tag)
          Deprecated. Put an integer with the specified tag.
 void putInteger(long v)
          Deprecated. Put an integer expressed as a long.
 void putInteger(long v, int tag)
          Deprecated. Put an integer expressed as a long with the specified tag.
protected  void putIntegerValue(int v)
          Deprecated. Put an integer value and move the current position backward.
protected  void putIntegerValue(long v)
          Deprecated. Put an integer value expressed as a long.
protected  void putLength(int length)
          Deprecated. Put a length and move the current position backward.
 void putNull()
          Deprecated. Put a NULL value.
 void putNull(int tag)
          Deprecated. Put a NULL value with a specified tag.
 void putOctetString(byte[] s)
          Deprecated. Put an octet string.
 void putOctetString(byte[] s, int tag)
          Deprecated. Put an octet string with a specified tag.
 void putOid(long[] s)
          Deprecated. Put an object identifier.
 void putOid(long[] s, int tag)
          Deprecated. Put an object identifier with a specified tag.
protected  void putOidValue(long[] s)
          Deprecated. Put an oid and move the current position backward.
protected  void putStringValue(byte[] s)
          Deprecated. Put a byte string and move the current position backward.
protected  void putTag(int tag)
          Deprecated. Put a tag and move the current position backward.
 void putUnsignedLong(long v, int tag)
          Deprecated.  
protected  void putUnsignedLongValue(long v)
          Deprecated.  
 int trim()
          Deprecated. Trim the encoding data and returns the length of the encoding.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, 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

bytes

protected final byte[] bytes
Deprecated. 

start

protected int start
Deprecated. 

stackBuf

protected final int[] stackBuf
Deprecated. 

stackTop

protected int stackTop
Deprecated. 
Constructor Detail

BerEncoder

public BerEncoder(byte[] b)
Deprecated. 
Constructs a new encoder and attaches it to the specified byte string.

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

trim

public int trim()
Deprecated. 
Trim the encoding data and returns the length of the encoding. The encoder does backward encoding : so the bytes buffer is filled from end to start. The encoded data must be shift before the buffer can be used. This is the purpose of the trim method. After a call to the trim method, the encoder is reinitialized and putXXX overwrite any existing encoded data.

Returns:
The length of the encoded data.

putUnsignedLong

public void putUnsignedLong(long v,
                            int tag)
Deprecated. 

putInteger

public void putInteger(int v)
Deprecated. 
Put an integer.

Parameters:
v - The integer to encode.

putInteger

public void putInteger(int v,
                       int tag)
Deprecated. 
Put an integer with the specified tag.

Parameters:
v - The integer to encode.
tag - The tag to encode.

putInteger

public void putInteger(long v)
Deprecated. 
Put an integer expressed as a long.

Parameters:
v - The long to encode.

putInteger

public void putInteger(long v,
                       int tag)
Deprecated. 
Put an integer expressed as a long with the specified tag.

Parameters:
v - The long to encode
tag - The tag to encode.

putOctetString

public void putOctetString(byte[] s)
Deprecated. 
Put an octet string.

Parameters:
s - The bytes to encode

putOctetString

public void putOctetString(byte[] s,
                           int tag)
Deprecated. 
Put an octet string with a specified tag.

Parameters:
s - The bytes to encode
tag - The tag to encode.

putOid

public void putOid(long[] s)
Deprecated. 
Put an object identifier.

Parameters:
s - The oid to encode.

putOid

public void putOid(long[] s,
                   int tag)
Deprecated. 
Put an object identifier with a specified tag.

Parameters:
s - The integer to encode.
tag - The tag to encode.

putNull

public void putNull()
Deprecated. 
Put a NULL value.


putNull

public void putNull(int tag)
Deprecated. 
Put a NULL value with a specified tag.

Parameters:
tag - The tag to encode.

putAny

public void putAny(byte[] s)
Deprecated. 
Put an ANY value. In fact, this method does not encode anything. It simply copies the specified bytes into the encoding.

Parameters:
s - The encoding of the ANY value.

putAny

public void putAny(byte[] s,
                   int byteCount)
Deprecated. 
Put an ANY value. Only the first byteCount are considered.

Parameters:
s - The encoding of the ANY value.
byteCount - The number of bytes of the encoding.

openSequence

public void openSequence()
Deprecated. 
Open a sequence. The encoder push the current position on its stack.


closeSequence

public void closeSequence()
Deprecated. 
Close a sequence. The decode pull the stack to know the end of the current sequence.


closeSequence

public void closeSequence(int tag)
Deprecated. 
Close a sequence with the specified tag.


putTag

protected final void putTag(int tag)
Deprecated. 
Put a tag and move the current position backward.

Parameters:
tag - The tag to encode.

putLength

protected final void putLength(int length)
Deprecated. 
Put a length and move the current position backward.

Parameters:
length - The length to encode.

putIntegerValue

protected final void putIntegerValue(int v)
Deprecated. 
Put an integer value and move the current position backward.

Parameters:
v - The integer to encode.

putIntegerValue

protected final void putIntegerValue(long v)
Deprecated. 
Put an integer value expressed as a long.

Parameters:
v - The integer to encode.

putUnsignedLongValue

protected void putUnsignedLongValue(long v)
Deprecated. 

putStringValue

protected final void putStringValue(byte[] s)
Deprecated. 
Put a byte string and move the current position backward.

Parameters:
s - The byte string to encode.

putOidValue

protected final void putOidValue(long[] s)
Deprecated. 
Put an oid and move the current position backward.

Parameters:
s - The oid to encode.

FCS Release
jdmk-5_1-b34.2 2005.11.29_16:24:00_MET

Copyright 1998-2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.