DEROctetStringParser (Bouncy Castle Library 1.85 API Specification)
Date: 2026-07-12

org.bouncycastle.asn1

## Class DEROctetStringParser

- java.lang.Object
- - org.bouncycastle.asn1.DEROctetStringParser

- All Implemented Interfaces:
    ASN1Encodable, ASN1OctetStringParser, InMemoryRepresentable

      public class DEROctetStringParser
      extends java.lang.Object
      implements ASN1OctetStringParser

  Parser for DER encoded OCTET STRINGS

- - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `ASN1Primitive` | `getLoadedObject()` Return an in-memory, encodable, representation of the OCTET STRING.
    `java.io.InputStream` | `getOctetStream()` Return an InputStream representing the contents of the OCTET STRING.
    `ASN1Primitive` | `toASN1Primitive()` Return an DEROctetString representing this parser and its contents.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### getOctetStream

          public java.io.InputStream getOctetStream()

      Return an InputStream representing the contents of the OCTET STRING.
      Specified by:
        `getOctetStream` in interface `ASN1OctetStringParser`
      Returns:
        an InputStream with its source as the OCTET STRING content.

    - #### getLoadedObject

          public ASN1Primitive getLoadedObject()
                                        throws java.io.IOException

      Return an in-memory, encodable, representation of the OCTET STRING.
      Specified by:
        `getLoadedObject` in interface `InMemoryRepresentable`
      Returns:
        a DEROctetString.
      Throws:
        `java.io.IOException` - if there is an issue loading the data.

    - #### toASN1Primitive

          public ASN1Primitive toASN1Primitive()

      Return an DEROctetString representing this parser and its contents.
      Specified by:
        `toASN1Primitive` in interface `ASN1Encodable`
      Returns:
        an DEROctetString