com.io7m.smfj.format.binary

## Class SMFFormatBinary

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

- All Implemented Interfaces:
    SMFParserProviderType, SMFVersionProbeProviderType, SMFSerializerProviderType

      public final class SMFFormatBinary
      extends Object
      implements SMFParserProviderType, SMFSerializerProviderType, SMFVersionProbeProviderType

  The implementation of the binary format.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SMFFormatBinary()` Construct a binary format provider.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static byte[]` | `magicNumber()`
    `SMFParserRandomAccessType` | `parserCreateRandomAccess(SMFParserEventsType in_events, URI in_uri, FileChannel in_channel)`
    `SMFParserSequentialType` | `parserCreateSequential(SMFParserEventsType in_events, URI in_uri, InputStream in_stream)`
    `SMFFormatDescription` | `parserFormat()`
    `javaslang.collection.SortedSet<SMFFormatVersion>` | `parserSupportedVersions()`
    `javaslang.control.Validation<javaslang.collection.Seq<SMFParseError>,SMFVersionProbed>` | `probe(InputStream stream)` Attempt to probe the given file stream.
    `SMFSerializerType` | `serializerCreate(SMFFormatVersion version, URI uri, OutputStream stream)`
    `SMFFormatDescription` | `serializerFormat()`
    `javaslang.collection.SortedSet<SMFFormatVersion>` | `serializerSupportedVersions()`
    `String` | `toString()`

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

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

- - ### Constructor Detail

    - #### SMFFormatBinary

          public SMFFormatBinary()

      Construct a binary format provider.

  - ### Method Detail

    - #### magicNumber

          public static byte[] magicNumber()

      Returns:
        The magic bytes at the start of every SMF file

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### parserFormat

          public SMFFormatDescription parserFormat()

      Specified by:
        `parserFormat` in interface `SMFParserProviderType`
      Returns:
        The format that this provider supports

    - #### parserSupportedVersions

          public javaslang.collection.SortedSet<SMFFormatVersion> parserSupportedVersions()

      Specified by:
        `parserSupportedVersions` in interface `SMFParserProviderType`
      Returns:
        The supported versions of the format

    - #### parserCreateSequential

          public SMFParserSequentialType parserCreateSequential(SMFParserEventsType in_events,
                                                                URI in_uri,
                                                                InputStream in_stream)

      Specified by:
        `parserCreateSequential` in interface `SMFParserProviderType`
      Parameters:
        `in_events` - The event receiver
        `in_uri` - The URI referred to by the input stream, for diagnostic messages
        `in_stream` - An input stream
      Returns:
        A new parser for the format
      See Also:
        `SMFFormatDescription.randomAccess()`

    - #### parserCreateRandomAccess

          public SMFParserRandomAccessType parserCreateRandomAccess(SMFParserEventsType in_events,
                                                                    URI in_uri,
                                                                    FileChannel in_channel)
                                                             throws UnsupportedOperationException

      Specified by:
        `parserCreateRandomAccess` in interface `SMFParserProviderType`
      Parameters:
        `in_events` - The event receiver
        `in_uri` - The URI referred to by the input stream, for diagnostic messages
        `in_channel` - A file channel
      Returns:
        A new parser for the format
      Throws:
        `UnsupportedOperationException` - If random-access parsing is not supported
      See Also:
        `SMFFormatDescription.randomAccess()`

    - #### serializerFormat

          public SMFFormatDescription serializerFormat()

      Specified by:
        `serializerFormat` in interface `SMFSerializerProviderType`
      Returns:
        The format that this provider supports

    - #### serializerSupportedVersions

          public javaslang.collection.SortedSet<SMFFormatVersion> serializerSupportedVersions()

      Specified by:
        `serializerSupportedVersions` in interface `SMFSerializerProviderType`
      Returns:
        The supported versions of the format

    - #### serializerCreate

          public SMFSerializerType serializerCreate(SMFFormatVersion version,
                                                    URI uri,
                                                    OutputStream stream)
                                             throws UnsupportedOperationException

      Specified by:
        `serializerCreate` in interface `SMFSerializerProviderType`
      Parameters:
        `version` - The format version
        `uri` - The URI referred to by the output stream, for diagnostic messages
        `stream` - An output stream
      Returns:
        A new serializer for the format
      Throws:
        `UnsupportedOperationException` - If the given version is not supported

    - #### probe

          public javaslang.control.Validation<javaslang.collection.Seq<SMFParseError>,SMFVersionProbed> probe(InputStream stream)

      Description copied from interface: `SMFVersionProbeProviderType`
      Attempt to probe the given file stream.
      Specified by:
        `probe` in interface `SMFVersionProbeProviderType`
      Parameters:
        `stream` - The stream
      Returns:
        A probed version or a list of errors

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