XCMS Toolkit

schemajic.decoder
Class DecodingStream

java.lang.Object
  extended by schemajic.decoder.DecodingStream

public class DecodingStream
extends java.lang.Object

Decodes values of ASN.1 types represented in a conceptual Tag - Length - Value (TLV) format under the Distinguished Encoding Rules (DER) of ASN.1.

Version:
1.00 - 2006/02/10
Author:
support@phillipgriffin.com

Constructor Summary
DecodingStream(java.io.InputStream s)
          Constructor for DecodingStream with input stream parameter.
 
Method Summary
 DecodedTLV decode()
          Decode a tag/length/value.
 DecodedTLV decode(TagList tags)
          Match each Tag in a TagList against the input stream.
 int getBytesRead()
          Returns the current stream of bytes that have been read.
 DecodedTLV peekNextTagLength()
          Peeks at the next TLV in the input stream.
 void readBytes(byte[] buffer)
          Read buffer.length raw bytes from the input stream into the buffer.
 byte[] readTLV()
          Reads a TLV from the input stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DecodingStream

public DecodingStream(java.io.InputStream s)
Constructor for DecodingStream with input stream parameter.

Parameters:
s - an input stream
Method Detail

decode

public DecodedTLV decode(TagList tags)
                  throws java.io.IOException
Match each Tag in a TagList against the input stream. Mark the stream in case the tags can't be matched - the stream will be reset and the tags that were read will be returned to the stream.

Parameters:
tags - a list of one or more tags (T)
Returns:
null or a DecodedTLV
Throws:
java.io.IOException

decode

public DecodedTLV decode()
                  throws java.io.IOException
Decode a tag/length/value. If the tag is primitive then the value bytes are read, otherwise only a tag/length is returned.

Returns:
null or a DecodedTLV
Throws:
java.io.IOException

peekNextTagLength

public DecodedTLV peekNextTagLength()
                             throws java.io.IOException
Peeks at the next TLV in the input stream.

Returns:
a new DecodedTLV
Throws:
java.io.IOException

readTLV

public byte[] readTLV()
               throws java.io.IOException
Reads a TLV from the input stream.

Returns:
the input stream storage buffer
Throws:
java.io.IOException

readBytes

public void readBytes(byte[] buffer)
               throws java.io.IOException
Read buffer.length raw bytes from the input stream into the buffer. This method facilitates the implementation of ASN.1 OpenType, where there is no tag present, and we want to read an entire tag/length/value without decoding the tag/length.

Parameters:
buffer - input stream storage
Throws:
java.io.IOException

getBytesRead

public int getBytesRead()
Returns the current stream of bytes that have been read.


XCMS Toolkit


Copyright © 2005-2006 GRIFFIN Consulting. All Rights Reserved.