org.apache.trevni.avro

## Class AvroColumnWriter<D>

- java.lang.Object
- - org.apache.trevni.avro.AvroColumnWriter<D>

-     public class AvroColumnWriter<D>
      extends Object

  Write Avro records to a Trevni column file.

  Each primitive type is written to a separate column.

  Output is buffered until `writeTo(OutputStream)` is called. The `sizeEstimate()` indicates both the amount of data buffered and the size of the file that will be written.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `SCHEMA_KEY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AvroColumnWriter(Schema s, ColumnFileMetaData meta)`
    `AvroColumnWriter(Schema s, ColumnFileMetaData meta, GenericData model)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `long` | `sizeEstimate()` Return the approximate size of the file that will be written.
    `void` | `write(D value)` Add a row to the file.
    `void` | `writeTo(File file)` Write all rows added to the named file.
    `void` | `writeTo(OutputStream out)` Write all rows added to the named output stream.

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

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

- - ### Field Detail

    - #### SCHEMA_KEY

          public static final String SCHEMA_KEY

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### AvroColumnWriter

          public AvroColumnWriter(Schema s,
                                  ColumnFileMetaData meta)
                           throws IOException

      Throws:
        `IOException`

    - #### AvroColumnWriter

          public AvroColumnWriter(Schema s,
                                  ColumnFileMetaData meta,
                                  GenericData model)
                           throws IOException

      Throws:
        `IOException`

  - ### Method Detail

    - #### sizeEstimate

          public long sizeEstimate()

      Return the approximate size of the file that will be written. Tries to slightly over-estimate. Indicates both the size in memory of the buffered data as well as the size of the file that will be written by `writeTo(OutputStream)`.

    - #### writeTo

          public void writeTo(OutputStream out)
                       throws IOException

      Write all rows added to the named output stream.
      Throws:
        `IOException`

    - #### writeTo

          public void writeTo(File file)
                       throws IOException

      Write all rows added to the named file.
      Throws:
        `IOException`

    - #### write

          public void write(D value)
                     throws IOException

      Add a row to the file.
      Throws:
        `IOException`

Copyright © 2009–2024 The Apache Software Foundation. All rights reserved.