|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.avro.file.DataFileWriter<D>
public class DataFileWriter<D>
Stores in a file a sequence of data conforming to a schema. The schema is
stored in the file with the data. Each datum in a file is of the same
schema. Data is written with a DatumWriter
. Data is grouped into
blocks. A synchronization marker is written between blocks, so that
files may be split. Blocks may be compressed. Extensible metadata is
stored at the end of the file. Files may be appended to.
DataFileReader
Constructor Summary | |
---|---|
DataFileWriter(Schema schema,
OutputStream outs,
DatumWriter<D> dout)
Construct a writer to a file for data matching a schema. |
Method Summary | |
---|---|
void |
addSchema(Schema branch)
If the schema for this file is a union, add a branch to it. |
void |
append(D datum)
Append a datum to the file. |
void |
close()
Close the file. |
void |
flush()
Flush the current state of the file, including metadata. |
void |
setMeta(String key,
byte[] value)
Set a metadata property. |
void |
setMeta(String key,
long value)
Set a metadata property. |
void |
setMeta(String key,
String value)
Set a metadata property. |
long |
sync()
Return the current position as a value that may be passed to DataFileReader.seek(long) . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DataFileWriter(Schema schema, OutputStream outs, DatumWriter<D> dout) throws IOException
IOException
Method Detail |
---|
public void setMeta(String key, byte[] value)
public void setMeta(String key, String value)
public void setMeta(String key, long value)
public void addSchema(Schema branch)
public void append(D datum) throws IOException
IOException
public long sync() throws IOException
DataFileReader.seek(long)
. Forces the end of the current block,
emitting a synchronization marker.
IOException
public void flush() throws IOException
IOException
public void close() throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |