Package com.io7m.cedarbridge.runtime.bssio

# Class CBSerializationContextBSSIO

java.lang.Object
com.io7m.cedarbridge.runtime.bssio.CBSerializationContextBSSIO

All Implemented Interfaces:
  `CBSerializationContextInputType`, `CBSerializationContextOutputType`, `CBSerializationContextTracingType`, `CBSerializationContextType`

public final class CBSerializationContextBSSIO extends Object implements CBSerializationContextType
A serialization context based on `jbssio`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `begin(String item)`
  Begin serializing the given item.
  `void`
  `begin(String item, int index)`
  Begin serializing the given item at index `index`.
  `static CBSerializationContextType`
  `create(com.io7m.jbssio.api.BSSReaderSequentialType reader, com.io7m.jbssio.api.BSSWriterSequentialType writer, CBSerializationContextFlushOperationType flushOp)`
  Create a context based on the reader and writer.
  `static CBSerializationContextType`
  `createFromByteArray(com.io7m.jbssio.api.BSSReaderProviderType readers, byte[] bytes)`
  Create a context based on the readers and byte array.
  `static CBSerializationContextType`
  `createFromInputStream(com.io7m.jbssio.api.BSSReaderProviderType readers, InputStream stream)`
  Create a context based on the input stream.
  `static CBSerializationContextType`
  `createFromOutputStream(com.io7m.jbssio.api.BSSWriterProviderType writers, OutputStream stream)`
  Create a context based on the output stream.
  `void`
  `end(String item)`
  Finish serializing the given item.
  `void`
  `end(String item, int index)`
  Finish serializing the given item at index `index`.
  `void`
  `flush()`
  Flush the underlying stream, ensuring any buffered output is written.
  `ByteBuffer`
  `readByteArray()`
  Read a byte array.
  `double`
  `readF16()`
  Read a floating point 16-bit value
  `double`
  `readF32()`
  Read a floating point 32-bit value
  `double`
  `readF64()`
  Read a floating point 64-bit value
  `int`
  `readS16()`
  Read a signed 16-bit value
  `int`
  `readS32()`
  Read a signed 32-bit value
  `long`
  `readS64()`
  Read a signed 64-bit value
  `int`
  `readS8()`
  Read a signed 8-bit value
  `int`
  `readSequenceLength()`
  Read a sequence length
  `int`
  `readU16()`
  Read an unsigned 16-bit value
  `long`
  `readU32()`
  Read an unsigned 32-bit value
  `long`
  `readU64()`
  Read an unsigned 64-bit value
  `int`
  `readU8()`
  Read an unsigned 8-bit value
  `String`
  `readUTF8()`
  Read a UTF-8 string.
  `int`
  `readVariantIndex()`
  Read a variant index
  `void`
  `writeByteArray(ByteBuffer x)`
  Write a byte array value.
  `void`
  `writeF16(double x)`
  Write a floating point 16-bit value
  `void`
  `writeF32(double x)`
  Write a floating point 32-bit value
  `void`
  `writeF64(double x)`
  Write a floating point 64-bit value
  `void`
  `writeS16(long x)`
  Write a signed 16-bit value
  `void`
  `writeS32(long x)`
  Write a signed 32-bit value
  `void`
  `writeS64(long x)`
  Write a signed 64-bit value
  `void`
  `writeS8(long x)`
  Write a signed 8-bit value
  `void`
  `writeSequenceLength(int size)`
  Write a sequence length
  `void`
  `writeU16(long x)`
  Write an unsigned 16-bit value
  `void`
  `writeU32(long x)`
  Write an unsigned 32-bit value
  `void`
  `writeU64(long x)`
  Write an unsigned 64-bit value
  `void`
  `writeU8(long x)`
  Write an unsigned 8-bit value
  `void`
  `writeUTF8(String x)`
  Write a UTF-8 string value.
  `void`
  `writeVariantIndex(int x)`
  Write a variant index

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

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

- ## Method Details

  - ### create

    public static CBSerializationContextType create(com.io7m.jbssio.api.BSSReaderSequentialType reader, com.io7m.jbssio.api.BSSWriterSequentialType writer, CBSerializationContextFlushOperationType flushOp)
    Create a context based on the reader and writer.
    Parameters:
      `reader` - The reader
      `writer` - The writer
      `flushOp` - An operation executed upon flushing the context
    Returns:
      A context

  - ### createFromOutputStream

    public static CBSerializationContextType createFromOutputStream(com.io7m.jbssio.api.BSSWriterProviderType writers, OutputStream stream)
    Create a context based on the output stream.
    Parameters:
      `writers` - The writers
      `stream` - The output stream
    Returns:
      A context

  - ### createFromInputStream

    public static CBSerializationContextType createFromInputStream(com.io7m.jbssio.api.BSSReaderProviderType readers, InputStream stream)
    Create a context based on the input stream.
    Parameters:
      `readers` - The readers
      `stream` - The input stream
    Returns:
      A context

  - ### createFromByteArray

    public static CBSerializationContextType createFromByteArray(com.io7m.jbssio.api.BSSReaderProviderType readers, byte[] bytes)
    Create a context based on the readers and byte array.
    Parameters:
      `readers` - The reader provider
      `bytes` - The byte array
    Returns:
      A context

  - ### readSequenceLength

    public int readSequenceLength() throws IOException
    Description copied from interface: `CBSerializationContextInputType`
    Read a sequence length
    Specified by:
      `readSequenceLength` in interface `CBSerializationContextInputType`
    Returns:
      The length
    Throws:
      `IOException` - On I/O errors

  - ### readVariantIndex

    public int readVariantIndex() throws IOException
    Description copied from interface: `CBSerializationContextInputType`
    Read a variant index
    Specified by:
      `readVariantIndex` in interface `CBSerializationContextInputType`
    Returns:
      The index
    Throws:
      `IOException` - On I/O errors

  - ### readS64

    public long readS64() throws IOException
    Description copied from interface: `CBSerializationContextInputType`
    Read a signed 64-bit value
    Specified by:
      `readS64` in interface `CBSerializationContextInputType`
    Returns:
      The value
    Throws:
      `IOException` - On I/O errors

  - ### readS32

    public int readS32() throws IOException
    Description copied from interface: `CBSerializationContextInputType`
    Read a signed 32-bit value
    Specified by:
      `readS32` in interface `CBSerializationContextInputType`
    Returns:
      The value
    Throws:
      `IOException` - On I/O errors

  - ### readS16

    public int readS16() throws IOException
    Description copied from interface: `CBSerializationContextInputType`
    Read a signed 16-bit value
    Specified by:
      `readS16` in interface `CBSerializationContextInputType`
    Returns:
      The value
    Throws:
      `IOException` - On I/O errors

  - ### readS8

    public int readS8() throws IOException
    Description copied from interface: `CBSerializationContextInputType`
    Read a signed 8-bit value
    Specified by:
      `readS8` in interface `CBSerializationContextInputType`
    Returns:
      The value
    Throws:
      `IOException` - On I/O errors

  - ### readU64

    public long readU64() throws IOException
    Description copied from interface: `CBSerializationContextInputType`
    Read an unsigned 64-bit value
    Specified by:
      `readU64` in interface `CBSerializationContextInputType`
    Returns:
      The value
    Throws:
      `IOException` - On I/O errors

  - ### readU32

    public long readU32() throws IOException
    Description copied from interface: `CBSerializationContextInputType`
    Read an unsigned 32-bit value
    Specified by:
      `readU32` in interface `CBSerializationContextInputType`
    Returns:
      The value
    Throws:
      `IOException` - On I/O errors

  - ### readU16

    public int readU16() throws IOException
    Description copied from interface: `CBSerializationContextInputType`
    Read an unsigned 16-bit value
    Specified by:
      `readU16` in interface `CBSerializationContextInputType`
    Returns:
      The value
    Throws:
      `IOException` - On I/O errors

  - ### readU8

    public int readU8() throws IOException
    Description copied from interface: `CBSerializationContextInputType`
    Read an unsigned 8-bit value
    Specified by:
      `readU8` in interface `CBSerializationContextInputType`
    Returns:
      The value
    Throws:
      `IOException` - On I/O errors

  - ### readF64

    public double readF64() throws IOException
    Description copied from interface: `CBSerializationContextInputType`
    Read a floating point 64-bit value
    Specified by:
      `readF64` in interface `CBSerializationContextInputType`
    Returns:
      The value
    Throws:
      `IOException` - On I/O errors

  - ### readF32

    public double readF32() throws IOException
    Description copied from interface: `CBSerializationContextInputType`
    Read a floating point 32-bit value
    Specified by:
      `readF32` in interface `CBSerializationContextInputType`
    Returns:
      The value
    Throws:
      `IOException` - On I/O errors

  - ### readF16

    public double readF16() throws IOException
    Description copied from interface: `CBSerializationContextInputType`
    Read a floating point 16-bit value
    Specified by:
      `readF16` in interface `CBSerializationContextInputType`
    Returns:
      The value
    Throws:
      `IOException` - On I/O errors

  - ### readByteArray

    public ByteBuffer readByteArray() throws IOException
    Description copied from interface: `CBSerializationContextInputType`
    Read a byte array.
    Specified by:
      `readByteArray` in interface `CBSerializationContextInputType`
    Returns:
      The value
    Throws:
      `IOException` - On I/O errors

  - ### readUTF8

    public String readUTF8() throws IOException
    Description copied from interface: `CBSerializationContextInputType`
    Read a UTF-8 string.
    Specified by:
      `readUTF8` in interface `CBSerializationContextInputType`
    Returns:
      The value
    Throws:
      `IOException` - On I/O errors

  - ### flush

    public void flush() throws IOException
    Description copied from interface: `CBSerializationContextOutputType`
    Flush the underlying stream, ensuring any buffered output is written.
    Specified by:
      `flush` in interface `CBSerializationContextOutputType`
    Throws:
      `IOException` - On I/O errors

  - ### writeSequenceLength

    public void writeSequenceLength(int size) throws IOException
    Description copied from interface: `CBSerializationContextOutputType`
    Write a sequence length
    Specified by:
      `writeSequenceLength` in interface `CBSerializationContextOutputType`
    Parameters:
      `size` - The size
    Throws:
      `IOException` - On I/O errors

  - ### writeVariantIndex

    public void writeVariantIndex(int x) throws IOException
    Description copied from interface: `CBSerializationContextOutputType`
    Write a variant index
    Specified by:
      `writeVariantIndex` in interface `CBSerializationContextOutputType`
    Parameters:
      `x` - The index
    Throws:
      `IOException` - On I/O errors

  - ### writeS64

    public void writeS64(long x) throws IOException
    Description copied from interface: `CBSerializationContextOutputType`
    Write a signed 64-bit value
    Specified by:
      `writeS64` in interface `CBSerializationContextOutputType`
    Parameters:
      `x` - The value
    Throws:
      `IOException` - On I/O errors

  - ### writeS32

    public void writeS32(long x) throws IOException
    Description copied from interface: `CBSerializationContextOutputType`
    Write a signed 32-bit value
    Specified by:
      `writeS32` in interface `CBSerializationContextOutputType`
    Parameters:
      `x` - The value
    Throws:
      `IOException` - On I/O errors

  - ### writeS16

    public void writeS16(long x) throws IOException
    Description copied from interface: `CBSerializationContextOutputType`
    Write a signed 16-bit value
    Specified by:
      `writeS16` in interface `CBSerializationContextOutputType`
    Parameters:
      `x` - The value
    Throws:
      `IOException` - On I/O errors

  - ### writeS8

    public void writeS8(long x) throws IOException
    Description copied from interface: `CBSerializationContextOutputType`
    Write a signed 8-bit value
    Specified by:
      `writeS8` in interface `CBSerializationContextOutputType`
    Parameters:
      `x` - The value
    Throws:
      `IOException` - On I/O errors

  - ### writeU64

    public void writeU64(long x) throws IOException
    Description copied from interface: `CBSerializationContextOutputType`
    Write an unsigned 64-bit value
    Specified by:
      `writeU64` in interface `CBSerializationContextOutputType`
    Parameters:
      `x` - The value
    Throws:
      `IOException` - On I/O errors

  - ### writeU32

    public void writeU32(long x) throws IOException
    Description copied from interface: `CBSerializationContextOutputType`
    Write an unsigned 32-bit value
    Specified by:
      `writeU32` in interface `CBSerializationContextOutputType`
    Parameters:
      `x` - The value
    Throws:
      `IOException` - On I/O errors

  - ### writeU16

    public void writeU16(long x) throws IOException
    Description copied from interface: `CBSerializationContextOutputType`
    Write an unsigned 16-bit value
    Specified by:
      `writeU16` in interface `CBSerializationContextOutputType`
    Parameters:
      `x` - The value
    Throws:
      `IOException` - On I/O errors

  - ### writeU8

    public void writeU8(long x) throws IOException
    Description copied from interface: `CBSerializationContextOutputType`
    Write an unsigned 8-bit value
    Specified by:
      `writeU8` in interface `CBSerializationContextOutputType`
    Parameters:
      `x` - The value
    Throws:
      `IOException` - On I/O errors

  - ### writeF64

    public void writeF64(double x) throws IOException
    Description copied from interface: `CBSerializationContextOutputType`
    Write a floating point 64-bit value
    Specified by:
      `writeF64` in interface `CBSerializationContextOutputType`
    Parameters:
      `x` - The value
    Throws:
      `IOException` - On I/O errors

  - ### writeF32

    public void writeF32(double x) throws IOException
    Description copied from interface: `CBSerializationContextOutputType`
    Write a floating point 32-bit value
    Specified by:
      `writeF32` in interface `CBSerializationContextOutputType`
    Parameters:
      `x` - The value
    Throws:
      `IOException` - On I/O errors

  - ### writeF16

    public void writeF16(double x) throws IOException
    Description copied from interface: `CBSerializationContextOutputType`
    Write a floating point 16-bit value
    Specified by:
      `writeF16` in interface `CBSerializationContextOutputType`
    Parameters:
      `x` - The value
    Throws:
      `IOException` - On I/O errors

  - ### writeByteArray

    public void writeByteArray(ByteBuffer x) throws IOException
    Description copied from interface: `CBSerializationContextOutputType`
    Write a byte array value.
    Specified by:
      `writeByteArray` in interface `CBSerializationContextOutputType`
    Parameters:
      `x` - The value
    Throws:
      `IOException` - On I/O errors

  - ### writeUTF8

    public void writeUTF8(String x) throws IOException
    Description copied from interface: `CBSerializationContextOutputType`
    Write a UTF-8 string value.
    Specified by:
      `writeUTF8` in interface `CBSerializationContextOutputType`
    Parameters:
      `x` - The value
    Throws:
      `IOException` - On I/O errors

  - ### begin

    public void begin(String item)
    Description copied from interface: `CBSerializationContextTracingType`
    Begin serializing the given item.
    Specified by:
      `begin` in interface `CBSerializationContextTracingType`
    Parameters:
      `item` - The item

  - ### begin

    public void begin(String item, int index)
    Description copied from interface: `CBSerializationContextTracingType`
    Begin serializing the given item at index `index`.
    Specified by:
      `begin` in interface `CBSerializationContextTracingType`
    Parameters:
      `item` - The item
      `index` - the index

  - ### end

    public void end(String item)
    Description copied from interface: `CBSerializationContextTracingType`
    Finish serializing the given item.
    Specified by:
      `end` in interface `CBSerializationContextTracingType`
    Parameters:
      `item` - The item

  - ### end

    public void end(String item, int index)
    Description copied from interface: `CBSerializationContextTracingType`
    Finish serializing the given item at index `index`.
    Specified by:
      `end` in interface `CBSerializationContextTracingType`
    Parameters:
      `item` - The item
      `index` - the index