uk.ac.starlink.feather

## Class VariableStarColumnWriter

- java.lang.Object
- - uk.ac.starlink.feather.StarColumnWriter
  - - uk.ac.starlink.feather.VariableStarColumnWriter

- All Implemented Interfaces:
    uk.ac.bristol.star.feather.FeatherColumnWriter

      public abstract class VariableStarColumnWriter
      extends StarColumnWriter

  StarColumnWriter implementations for variable-length values.
  Since:
    27 Feb 2020

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `VariableStarColumnWriter.PointerSize` Enumeration for pointer size.

    - ### Nested classes/interfaces inherited from class uk.ac.starlink.feather.StarColumnWriter

      `StarColumnWriter.DataStat`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `VariableStarColumnWriter(StarTable table, int icol, uk.ac.bristol.star.feather.FeatherType ftype, boolean isNullable, VariableStarColumnWriter.PointerSize psize)` Constructor.

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static VariableStarColumnWriter` | `createByteArrayWriter(StarTable table, int icol, boolean isNullable, VariableStarColumnWriter.PointerSize psize)` Returns a column writer for variable-length byte array values.
    `ItemAccumulator` | `createItemAccumulator(StoragePolicy storage)`
    `static VariableStarColumnWriter` | `createStringWriter(StarTable table, int icol, boolean isNullable, VariableStarColumnWriter.PointerSize psize)` Returns a column writer for variable-length string values.
    `abstract int` | `getItemSize(java.lang.Object item)` Returns the number of bytes that a given item will occupy in the output stream.
    `StarColumnWriter.DataStat` | `writeDataBytes(java.io.OutputStream out)` Writes the bytes consituting the data stream for this column, excluding any optional validity mask.
    `abstract int` | `writeItemBytes(java.io.OutputStream out, java.lang.Object item)` Writes a value to the output stream.

    - ### Methods inherited from class uk.ac.starlink.feather.StarColumnWriter

      `getColumnIndex, getFeatherType, getName, getTable, getUserMetadata, isNullable, writeColumnBytes`

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

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

- - ### Constructor Detail

    - #### VariableStarColumnWriter

          protected VariableStarColumnWriter(StarTable table,
                                             int icol,
                                             uk.ac.bristol.star.feather.FeatherType ftype,
                                             boolean isNullable,
                                             VariableStarColumnWriter.PointerSize psize)

      Constructor.
      Parameters:
        `table` - input table
        `icol` - column index
        `ftype` - output data type
        `isNullable` - if true, nulls will be marked as invalid; if false, they will just be represented as zero length
        `psize` - pointer size

  - ### Method Detail

    - #### getItemSize

          public abstract int getItemSize(java.lang.Object item)

      Returns the number of bytes that a given item will occupy in the output stream.
      Parameters:
        `item` - writable value
      Returns:
        byte count

    - #### writeItemBytes

          public abstract int writeItemBytes(java.io.OutputStream out,
                                             java.lang.Object item)
                                      throws java.io.IOException

      Writes a value to the output stream. The output value must be consistent with `getItemSize(java.lang.Object)`.
      Parameters:
        `out` - destination stream
        `item` - writable value
      Returns:
        number of bytes written
      Throws:
        `java.io.IOException`

    - #### writeDataBytes

          public StarColumnWriter.DataStat writeDataBytes(java.io.OutputStream out)
                                                   throws java.io.IOException

      Description copied from class: `StarColumnWriter`
      Writes the bytes consituting the data stream for this column, excluding any optional validity mask. Note the output does not need to be aligned on an 8-byte boundary.
      Specified by:
        `writeDataBytes` in class `StarColumnWriter`
      Parameters:
        `out` - destination stream
      Returns:
        information about what was actually written
      Throws:
        `java.io.IOException`

    - #### createItemAccumulator

          public ItemAccumulator createItemAccumulator(StoragePolicy storage)

      Specified by:
        `createItemAccumulator` in class `StarColumnWriter`

    - #### createStringWriter

          public static VariableStarColumnWriter createStringWriter(StarTable table,
                                                                    int icol,
                                                                    boolean isNullable,
                                                                    VariableStarColumnWriter.PointerSize psize)

      Returns a column writer for variable-length string values.
      Parameters:
        `table` - input table
        `icol` - column index
        `isNullable` - if true, nulls will be marked as invalid; if false, they will just be represented as zero length strings
        `psize` - pointer size

    - #### createByteArrayWriter

          public static VariableStarColumnWriter createByteArrayWriter(StarTable table,
                                                                       int icol,
                                                                       boolean isNullable,
                                                                       VariableStarColumnWriter.PointerSize psize)

      Returns a column writer for variable-length byte array values.
      Parameters:
        `table` - input table
        `icol` - column index
        `isNullable` - if true, nulls will be marked as invalid; if false, they will just be represented as zero length arrays
        `psize` - pointer size