org.pfsw.tools.beluga.ldap.protocol.ber
Class ProtocolDecoder

java.lang.Object
  extended by org.pfsw.tools.beluga.ldap.protocol.ber.ProtocolDecoder

public class ProtocolDecoder
extends Object

A protocol decoder that helps to get the data from a BER encoded stream to useful objects.

Version:
1.0
Author:
Manfred Duchrow

Constructor Summary
ProtocolDecoder(byte[] data)
          Initialize the new instance with default values.
 
Method Summary
 int bytesLeft()
          Returns the number of bytes left in the decoder to parse
 SequenceInfo getPutBackSequence()
           
 boolean hasMoreData()
          Returns true if ther is more data available in the decoder
 boolean hasPutBackSequence()
          Returns true if the decoder has a sequence that was put back for further parsing.
 boolean isEndOfSequence(SequenceInfo seqInfo)
          Returns true if this decoder has reached the parse position which is the end of the given sequence info.
 boolean notDoneForSequence(SequenceInfo seqInfo)
          Returns true if this decoder has NOT yet reached the parse position which is the end of the given sequence info and if it still has data.
 boolean parseBoolean()
          Returns next data from the stream as boolean
 int parseByte()
          Returns the next byte ;
 int parseEnumeration()
          Returns the next data as enumeration tag
 int parseInteger()
          Returns the next integer from the underlying data
 byte[] parsePassword()
          Returns the password as byte array from the next data in the stream
 SequenceInfo parseSequence()
          Returns the next bytes as SEQUENCE information
 int parseSequenceTag()
          Returns only the next byte as SEQUENCE tag
 String parseString()
          Returns the next string from the underlying data
 String parseString(int length)
          Returns the next length bytes as string from the underlying data
 SubstringFilter parseSubstringFilter()
           
 void setPutBackSequence(SequenceInfo newValue)
           
 boolean useUTF8()
           
 void useUTF8(boolean newValue)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProtocolDecoder

public ProtocolDecoder(byte[] data)
Initialize the new instance with default values.

Method Detail

useUTF8

public boolean useUTF8()

useUTF8

public void useUTF8(boolean newValue)

getPutBackSequence

public SequenceInfo getPutBackSequence()

setPutBackSequence

public void setPutBackSequence(SequenceInfo newValue)

parseSequence

public SequenceInfo parseSequence()
                           throws Exception
Returns the next bytes as SEQUENCE information

Throws:
Exception

parseSequenceTag

public int parseSequenceTag()
                     throws Exception
Returns only the next byte as SEQUENCE tag

Throws:
Exception

parseInteger

public int parseInteger()
                 throws Exception
Returns the next integer from the underlying data

Throws:
Exception

parseString

public String parseString()
                   throws Exception
Returns the next string from the underlying data

Throws:
Exception

parseString

public String parseString(int length)
                   throws Exception
Returns the next length bytes as string from the underlying data

Throws:
Exception

parsePassword

public byte[] parsePassword()
                     throws Exception
Returns the password as byte array from the next data in the stream

Throws:
Exception

parseEnumeration

public int parseEnumeration()
                     throws Exception
Returns the next data as enumeration tag

Throws:
Exception

parseBoolean

public boolean parseBoolean()
                     throws Exception
Returns next data from the stream as boolean

Throws:
Exception

parseByte

public int parseByte()
              throws Exception
Returns the next byte ;

Throws:
Exception

parseSubstringFilter

public SubstringFilter parseSubstringFilter()
                                     throws Exception
Throws:
Exception

bytesLeft

public int bytesLeft()
Returns the number of bytes left in the decoder to parse


hasMoreData

public boolean hasMoreData()
Returns true if ther is more data available in the decoder


hasPutBackSequence

public boolean hasPutBackSequence()
Returns true if the decoder has a sequence that was put back for further parsing.


isEndOfSequence

public boolean isEndOfSequence(SequenceInfo seqInfo)
Returns true if this decoder has reached the parse position which is the end of the given sequence info.


notDoneForSequence

public boolean notDoneForSequence(SequenceInfo seqInfo)
Returns true if this decoder has NOT yet reached the parse position which is the end of the given sequence info and if it still has data.



Copyright © 2012 Manfred Duchrow Consulting & Software. All Rights Reserved.