com.io7m.smfj.format.binary

## Class SMFBDataStreamReader

- java.lang.Object
- - com.io7m.smfj.format.binary.SMFBDataStreamReader

- All Implemented Interfaces:
    SMFBDataStreamReaderType

      public final class SMFBDataStreamReader
      extends Object
      implements SMFBDataStreamReaderType

  The default implementation of the `SMFBDataStreamReaderType` interface.

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static SMFBDataStreamReaderType` | `create(URI in_uri, InputStream in_stream)` Create a data stream reader.
    `long` | `position()`
    `com.io7m.jlexing.core.LexicalPosition<URI>` | `positionLexical()`
    `void` | `readBytes(Optional<String> name, byte[] b)` Read exactly `b.length` octets from the stream, raising an error if too few octets are available.
    `double` | `readF16(Optional<String> name)` Read an IEEE754-binary16 value from the stream.
    `double` | `readF32(Optional<String> name)` Read an IEEE754-binary32 value from the stream.
    `double` | `readF64(Optional<String> name)` Read an IEEE754-binary64 value from the stream.
    `long` | `readS16(Optional<String> name)` Read a signed 16-bit value from the stream.
    `long` | `readS32(Optional<String> name)` Read a signed 32-bit value from the stream.
    `long` | `readS64(Optional<String> name)` Read a signed 64-bit value from the stream.
    `long` | `readS8(Optional<String> name)` Read a signed 8-bit value from the stream.
    `long` | `readU16(Optional<String> name)` Read an unsigned 16-bit value from the stream.
    `long` | `readU32(Optional<String> name)` Read an unsigned 32-bit value from the stream.
    `long` | `readU64(Optional<String> name)` Read an unsigned 64-bit value from the stream.
    `long` | `readU8(Optional<String> name)` Read an unsigned 8-bit value from the stream.
    `void` | `skip(long count)` Skip ahead `count` octets in the stream.
    `URI` | `uri()`
    `SMFBDataStreamReaderType` | `withBounds(long size)` Create a new view of this reader that is only allowed to read `size` more octets from the current stream.

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

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

    - ### Methods inherited from interface com.io7m.smfj.format.binary.SMFBDataStreamReaderType

      `skipTo`

- - ### Method Detail

    - #### create

          public static SMFBDataStreamReaderType create(URI in_uri,
                                                        InputStream in_stream)

      Create a data stream reader.
      Parameters:
        `in_uri` - The uri
        `in_stream` - The stream
      Returns:
        A new data stream reader

    - #### uri

          public URI uri()

      Specified by:
        `uri` in interface `SMFBDataStreamReaderType`
      Returns:
        The URI referred to by the stream

    - #### readBytes

          public void readBytes(Optional<String> name,
                                byte[] b)
                         throws IOException

      Description copied from interface: `SMFBDataStreamReaderType`
      Read exactly `b.length` octets from the stream, raising an error if too few octets are available.
      Specified by:
        `readBytes` in interface `SMFBDataStreamReaderType`
      Parameters:
        `name` - A field name for precise error reporting
        `b` - The output octets
      Throws:
        `IOException` - On I/O errors

    - #### position

          public long position()

      Specified by:
        `position` in interface `SMFBDataStreamReaderType`
      Returns:
        The current stream position; the number of octets consumed so far

    - #### readU8

          public long readU8(Optional<String> name)
                      throws IOException

      Description copied from interface: `SMFBDataStreamReaderType`
      Read an unsigned 8-bit value from the stream.
      Specified by:
        `readU8` in interface `SMFBDataStreamReaderType`
      Parameters:
        `name` - A field name for precise error reporting
      Returns:
        The read value
      Throws:
        `IOException` - On I/O errors

    - #### readS8

          public long readS8(Optional<String> name)
                      throws IOException

      Description copied from interface: `SMFBDataStreamReaderType`
      Read a signed 8-bit value from the stream.
      Specified by:
        `readS8` in interface `SMFBDataStreamReaderType`
      Parameters:
        `name` - A field name for precise error reporting
      Returns:
        The read value
      Throws:
        `IOException` - On I/O errors

    - #### readU16

          public long readU16(Optional<String> name)
                       throws IOException

      Description copied from interface: `SMFBDataStreamReaderType`
      Read an unsigned 16-bit value from the stream.
      Specified by:
        `readU16` in interface `SMFBDataStreamReaderType`
      Parameters:
        `name` - A field name for precise error reporting
      Returns:
        The read value
      Throws:
        `IOException` - On I/O errors

    - #### readS16

          public long readS16(Optional<String> name)
                       throws IOException

      Description copied from interface: `SMFBDataStreamReaderType`
      Read a signed 16-bit value from the stream.
      Specified by:
        `readS16` in interface `SMFBDataStreamReaderType`
      Parameters:
        `name` - A field name for precise error reporting
      Returns:
        The read value
      Throws:
        `IOException` - On I/O errors

    - #### readU32

          public long readU32(Optional<String> name)
                       throws IOException

      Description copied from interface: `SMFBDataStreamReaderType`
      Read an unsigned 32-bit value from the stream.
      Specified by:
        `readU32` in interface `SMFBDataStreamReaderType`
      Parameters:
        `name` - A field name for precise error reporting
      Returns:
        The read value
      Throws:
        `IOException` - On I/O errors

    - #### readS32

          public long readS32(Optional<String> name)
                       throws IOException

      Description copied from interface: `SMFBDataStreamReaderType`
      Read a signed 32-bit value from the stream.
      Specified by:
        `readS32` in interface `SMFBDataStreamReaderType`
      Parameters:
        `name` - A field name for precise error reporting
      Returns:
        The read value
      Throws:
        `IOException` - On I/O errors

    - #### readU64

          public long readU64(Optional<String> name)
                       throws IOException

      Description copied from interface: `SMFBDataStreamReaderType`
      Read an unsigned 64-bit value from the stream.
      Specified by:
        `readU64` in interface `SMFBDataStreamReaderType`
      Parameters:
        `name` - A field name for precise error reporting
      Returns:
        The read value
      Throws:
        `IOException` - On I/O errors

    - #### readS64

          public long readS64(Optional<String> name)
                       throws IOException

      Description copied from interface: `SMFBDataStreamReaderType`
      Read a signed 64-bit value from the stream.
      Specified by:
        `readS64` in interface `SMFBDataStreamReaderType`
      Parameters:
        `name` - A field name for precise error reporting
      Returns:
        The read value
      Throws:
        `IOException` - On I/O errors

    - #### readF16

          public double readF16(Optional<String> name)
                         throws IOException

      Description copied from interface: `SMFBDataStreamReaderType`
      Read an IEEE754-binary16 value from the stream.
      Specified by:
        `readF16` in interface `SMFBDataStreamReaderType`
      Parameters:
        `name` - A field name for precise error reporting
      Returns:
        The read value
      Throws:
        `IOException` - On I/O errors

    - #### readF32

          public double readF32(Optional<String> name)
                         throws IOException

      Description copied from interface: `SMFBDataStreamReaderType`
      Read an IEEE754-binary32 value from the stream.
      Specified by:
        `readF32` in interface `SMFBDataStreamReaderType`
      Parameters:
        `name` - A field name for precise error reporting
      Returns:
        The read value
      Throws:
        `IOException` - On I/O errors

    - #### readF64

          public double readF64(Optional<String> name)
                         throws IOException

      Description copied from interface: `SMFBDataStreamReaderType`
      Read an IEEE754-binary64 value from the stream.
      Specified by:
        `readF64` in interface `SMFBDataStreamReaderType`
      Parameters:
        `name` - A field name for precise error reporting
      Returns:
        The read value
      Throws:
        `IOException` - On I/O errors

    - #### skip

          public void skip(long count)
                    throws IOException

      Description copied from interface: `SMFBDataStreamReaderType`
      Skip ahead `count` octets in the stream.
      Specified by:
        `skip` in interface `SMFBDataStreamReaderType`
      Parameters:
        `count` - The number of octets to skip
      Throws:
        `IOException` - On I/O errors

    - #### positionLexical

          public com.io7m.jlexing.core.LexicalPosition<URI> positionLexical()

      Specified by:
        `positionLexical` in interface `SMFBDataStreamReaderType`
      Returns:
        The current stream position; the number of octets consumed so far

    - #### withBounds

          public SMFBDataStreamReaderType withBounds(long size)

      Description copied from interface: `SMFBDataStreamReaderType`
      Create a new view of this reader that is only allowed to read `size` more octets from the current stream. Reading from the newly created reader will advance the position of the current reader as well.
      Specified by:
        `withBounds` in interface `SMFBDataStreamReaderType`
      Parameters:
        `size` - The maximum number of octets that can be read
      Returns:
        A new reader

Copyright © 2017 <code@io7m.com> http://io7m.com