Skip navigation links

Oracle Security Developer Tools Crypto FIPS Java API Reference
11g (11.1.1)

E10696-02


oracle.security.crypto.asn1
Class ASN1ConstructedInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by oracle.security.crypto.asn1.ASN1ConstructedInputStream

All Implemented Interfaces:
java.io.Closeable
Direct Known Subclasses:
ASN1SequenceInputStream, ASN1SetInputStream

public class ASN1ConstructedInputStream
extends java.io.FilterInputStream

A stream for reading one ASN.1 constructed encoding. Allows one-byte lookahead.


Field Summary

 

Fields inherited from class java.io.FilterInputStream
in

 

Constructor Summary
ASN1ConstructedInputStream(java.io.InputStream is)
          Creates a new ASN1ConstructedInputStream which will read from the specified input stream, which must be positioned just before the identifier octets of an ASN.1 encoding.
ASN1ConstructedInputStream(java.io.InputStream is, ASN1Header header)
          Creates a new ASN1ConstructedInputStream which will read from the specified input stream, which must be positioned just before the contents octets of an ASN.1 encoding.
ASN1ConstructedInputStream(java.io.InputStream is, int tag)
          Creates a new ASN1ConstructedInputStream which will read from the specified input stream, which must be positioned just before the identifier octets of an ASN.1 encoding.
ASN1ConstructedInputStream(java.io.InputStream is, int tag, int tagClass)
          Creates a new ASN1ConstructedInputStream which will read from the specified input stream, which must be positioned just before the identifier octets of an ASN.1 encoding.

 

Method Summary
 int available()
           
 int getCurrentIDByte()
          Returns the current tag ID (tag class, tag type...)
 int getCurrentTag()
          Returns the current tag.
 boolean hasMoreData()
          Returns true if the ASN1Constructed contained in this stream has not yet been completely read, otherwise false.
 boolean markSupported()
          Always returns false.
 int read()
          Reads one byte.
 int read(byte[] b, int off, int len)
           
 void setCurrentTag(int tag)
          Sets the current tag (and the current tag class to UNIVERSAL).
 void terminate()
          Invoking this method signals that all input from this constructed object has been read.
 void terminate(boolean skipRemaining)
          Invoking this method signals that all input from this constructed object has been read.

 

Methods inherited from class java.io.FilterInputStream
close, mark, read, reset, skip

 

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

 

Constructor Detail

ASN1ConstructedInputStream

public ASN1ConstructedInputStream(java.io.InputStream is)
                           throws java.io.IOException
Creates a new ASN1ConstructedInputStream which will read from the specified input stream, which must be positioned just before the identifier octets of an ASN.1 encoding.

The encoding must have the context-specific tag class and the constructed bit set, otherwise an ASN.1 format exception is thrown.

When this constructor returns, the underlying input stream will be positioned just before the contents octets of the encoding.

Parameters:
is - the underlying input stream, positioned just before the initial (identifier) octets of an ASN.1 encoding
Throws:
ASN1FormatException - if the wrong tag or tag class is encountered, or the encoding being read is not a constructed encoding
java.io.IOException

ASN1ConstructedInputStream

public ASN1ConstructedInputStream(java.io.InputStream is,
                                  int tag)
                           throws java.io.IOException
Creates a new ASN1ConstructedInputStream which will read from the specified input stream, which must be positioned just before the identifier octets of an ASN.1 encoding.

The encoding must have the context-specific tag class and the specified tag value, otherwise an ASN.1 format exception is thrown.

When this constructor returns, the underlying input stream will be positioned just before the contents octets of the encoding.

Parameters:
is - the underlying input stream, positioned just before the initial (identifier) octets of an ASN.1 encoding
tag - the expected tag
Throws:
ASN1FormatException - if the wrong tag or tag class is encountered, or the encoding being read is not a constructed encoding
java.io.IOException

ASN1ConstructedInputStream

public ASN1ConstructedInputStream(java.io.InputStream is,
                                  int tag,
                                  int tagClass)
                           throws java.io.IOException
Creates a new ASN1ConstructedInputStream which will read from the specified input stream, which must be positioned just before the identifier octets of an ASN.1 encoding.

The encoding must have the specified tag and tag class, otherwise an ASN.1 format exception is thrown.

When this constructor returns, the underlying input stream will be positioned just before the contents octets of the encoding.

Parameters:
is - the underlying input stream, positioned just before the initial (identifier) octets of an ASN.1 encoding
tag - the expected tag
Throws:
ASN1FormatException - if the wrong tag or tag class is encountered, or the encoding being read is not a constructed encoding
java.io.IOException

ASN1ConstructedInputStream

public ASN1ConstructedInputStream(java.io.InputStream is,
                                  ASN1Header header)
Creates a new ASN1ConstructedInputStream which will read from the specified input stream, which must be positioned just before the contents octets of an ASN.1 encoding.

Unlike the other constructors of this class, this constructor does not reader the header from the underlying input stream; instead the header is specified as a parameter.

Method Detail

read

public int read()
         throws java.io.IOException
Reads one byte.

If end of stream is encountered, this method does not return -1; instead it throws an ASN1FormatException.

Overrides:
read in class java.io.FilterInputStream
Throws:
java.io.IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Overrides:
read in class java.io.FilterInputStream
Throws:
java.io.IOException

available

public int available()
              throws java.io.IOException
Overrides:
available in class java.io.FilterInputStream
Throws:
java.io.IOException

markSupported

public boolean markSupported()
Always returns false.
Overrides:
markSupported in class java.io.FilterInputStream

hasMoreData

public boolean hasMoreData()
                    throws java.io.IOException
Returns true if the ASN1Constructed contained in this stream has not yet been completely read, otherwise false.
Throws:
java.io.IOException

terminate

public void terminate(boolean skipRemaining)
               throws java.io.IOException
Invoking this method signals that all input from this constructed object has been read.

If the position of this stream is not at the end of the contents octets, then the skipRemaining parameter must be true.

For an indefinite-length encoding, causes any end-of-contents bytes to be read.

After calling this method, is an error to invoke any other method on this object except close().

It is an error to invoke this method if the pushback buffer is not empty.

Parameters:
skipRemaining - If the position of this stream is not at the end of the contents octets, then this must be true.
Throws:
java.io.IOException

terminate

public void terminate()
               throws java.io.IOException
Invoking this method signals that all input from this constructed object has been read. The position of this stream must be at the end of the contents octets.

For an indefinite-length encoding, causes any end-of-contents bytes to be read.

After calling this method, is an error to invoke any other method on this object except close().

It is an error to invoke this method if the pushback buffer is not empty.

Throws:
java.io.IOException

getCurrentIDByte

public int getCurrentIDByte()
                     throws java.io.IOException
Returns the current tag ID (tag class, tag type...)
Returns:
the current tag or -1 if at end of body
Throws:
java.io.IOException

getCurrentTag

public int getCurrentTag()
                  throws java.io.IOException
Returns the current tag.
Returns:
the current tag, if in the range 0..30; 31 if the current tag is outside that range; or -1 if at end of body
Throws:
java.io.IOException

setCurrentTag

public void setCurrentTag(int tag)
                   throws java.io.IOException
Sets the current tag (and the current tag class to UNIVERSAL).
Parameters:
tag - the new tag value (must be in the range 0..30)
Throws:
java.io.IOException

Skip navigation links

Oracle Security Developer Tools Crypto FIPS Java API Reference
11g (11.1.1)

E10696-02


Copyright © 2005, 2009, Oracle. All rights reserved.