Package org.apache.trevni
Class ColumnFileWriter
java.lang.Object
org.apache.trevni.ColumnFileWriter
Writes data to a column file. All data is buffered until
writeTo(File)
is called.-
Constructor Summary
ConstructorDescriptionColumnFileWriter
(ColumnFileMetaData fileMeta, ColumnMetaData... columnMeta) Construct given metadata for each column in the file. -
Method Summary
Modifier and TypeMethodDescriptionvoid
endRow()
Expert: Called after all values are written to a row.int
Return the number of columns in the file.Return this file's metadata.long
Return the approximate size of the file that will be written.void
startRow()
Expert: Called before any values are written to a row.void
writeLength
(int length, int column) Expert: Declare a count of items to be written to an array column or a column whose parent is an array.void
Add a row to the file.void
Write all rows added to the named file.void
writeTo
(OutputStream out) Write all rows added to the named output stream.void
writeValue
(Object value, int column) Expert: Add a value to a row.
-
Constructor Details
-
ColumnFileWriter
public ColumnFileWriter(ColumnFileMetaData fileMeta, ColumnMetaData... columnMeta) throws IOException Construct given metadata for each column in the file.- 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 bywriteTo(OutputStream)
. -
getMetaData
Return this file's metadata. -
getColumnCount
public int getColumnCount()Return the number of columns in the file. -
writeRow
Add a row to the file.- Throws:
IOException
-
startRow
Expert: Called before any values are written to a row.- Throws:
IOException
-
writeLength
Expert: Declare a count of items to be written to an array column or a column whose parent is an array.- Throws:
IOException
-
writeValue
Expert: Add a value to a row. For values in array columns or whose parents are array columns, this must be preceded by a call towriteLength(int, int)
and must be called that many times. For normal columns this is called once for each row in the column.- Throws:
IOException
-
endRow
Expert: Called after all values are written to a row.- Throws:
IOException
-
writeTo
Write all rows added to the named file.- Throws:
IOException
-
writeTo
Write all rows added to the named output stream.- Throws:
IOException
-