Package 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
Description
`static final String`
`SCHEMA_KEY`

## Constructor Summary

Constructors
Constructor
Description
`AvroColumnWriter(org.apache.avro.Schema s, org.apache.trevni.ColumnFileMetaData meta)`
`AvroColumnWriter(org.apache.avro.Schema s, org.apache.trevni.ColumnFileMetaData meta, org.apache.avro.generic.GenericData model)`

## Method Summary

Modifier and Type
Method
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 Details

### SCHEMA_KEY

public static final String SCHEMA_KEY

See Also:
  - Constant Field Values

## Constructor Details

### AvroColumnWriter

public AvroColumnWriter(org.apache.avro.Schema s, org.apache.trevni.ColumnFileMetaData meta) throws IOException

Throws:
  `IOException`

### AvroColumnWriter

public AvroColumnWriter(org.apache.avro.Schema s, org.apache.trevni.ColumnFileMetaData meta, org.apache.avro.generic.GenericData model) throws IOException

Throws:
  `IOException`

## Method Details

### 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`