org.eclipse.osgi.internal.signedcontent
Class BERProcessor

java.lang.Object
  extended by org.eclipse.osgi.internal.signedcontent.BERProcessor

public class BERProcessor
extends Object

This is a simple class that processes BER structures. This class uses BER processing as outlined in X.690.


Field Summary
 boolean constructed
          True if this is a structure for a constructed encoding.
 byte tag
          The tag type.
 
Constructor Summary
BERProcessor(byte[] buffer, int offset, int len)
          Constructs a BERProcessor to operate on the passed buffer.
 
Method Summary
 boolean endOfSequence()
           
 byte[] getBytes()
          Get a copy of the bytes in the content of the current structure.
 BigInteger getIntValue()
          Gets the content from the current structure as an int.
 int[] getObjId()
          Gets the content from the current structure as an object id (int[]).
 String getString()
          Gets the content from the current structure as a String.
 void processStructure()
          Parse the structure found at the current offset into buffer.
 BERProcessor stepInto()
          Returns a BERProcessor for the content of the current structure.
 void stepOver()
           
 String toString()
          Returns a String representation of the current BER structure.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

constructed

public boolean constructed
True if this is a structure for a constructed encoding.


tag

public byte tag
The tag type. Note that X.690 specifies encodings for tags with values greater than 31, but currently this class does not handle these kinds of tags.

Constructor Detail

BERProcessor

public BERProcessor(byte[] buffer,
                    int offset,
                    int len)
             throws SignatureException
Constructs a BERProcessor to operate on the passed buffer. The first structure in the buffer will be processed before this method returns.

Parameters:
buffer - the buffer containing the BER structures.
offset - the offset into buffer to the start of the first structure.
len - the length of the BER structure.
Throws:
SignatureException
Method Detail

processStructure

public void processStructure()
                      throws SignatureException
Parse the structure found at the current offset into buffer. Most methods, constructor, and stepinto, will call this method automatically. If offset is modified outside of those methods, this method will need to be invoked.

Throws:
SignatureException

toString

public String toString()
Returns a String representation of the current BER structure.

Overrides:
toString in class Object
Returns:
a String representation of the current BER structure.
See Also:
Object.toString()

stepInto

public BERProcessor stepInto()
                      throws SignatureException
Returns a BERProcessor for the content of the current structure.

Throws:
SignatureException

stepOver

public void stepOver()
              throws SignatureException
Throws:
SignatureException

endOfSequence

public boolean endOfSequence()

getString

public String getString()
Gets the content from the current structure as a String.

Returns:
the content from the current structure as a String.

getIntValue

public BigInteger getIntValue()
Gets the content from the current structure as an int.

Returns:
the content from the current structure as an int.

getObjId

public int[] getObjId()
Gets the content from the current structure as an object id (int[]).

Returns:
the content from the current structure as an object id (int[]).

getBytes

public byte[] getBytes()
Get a copy of the bytes in the content of the current structure.

Returns:
a copy of the bytes in the content of the current structure.


Copyright © 2007–2014 The Apache Software Foundation. All rights reserved.