|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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(DatumWriter<D> dout)
Construct a writer, not yet open. |
Method Summary | |
---|---|
void |
append(D datum)
Append a datum to the file. |
void |
appendAllFrom(DataFileStream<D> otherFile,
boolean recompress)
Appends data from another file. |
void |
appendEncoded(ByteBuffer datum)
Expert: Append a pre-encoded datum to the file. |
DataFileWriter<D> |
appendTo(File file)
Open a writer appending to an existing file. |
void |
close()
Close the file. |
DataFileWriter<D> |
create(Schema schema,
File file)
Open a new file for data matching a schema. |
DataFileWriter<D> |
create(Schema schema,
OutputStream outs)
Open a new file for data matching a schema. |
void |
flush()
Flush the current state of the file. |
static boolean |
isReservedMeta(String key)
|
DataFileWriter<D> |
setCodec(CodecFactory c)
Configures this writer to use the given codec. |
DataFileWriter<D> |
setMeta(String key,
byte[] value)
Set a metadata property. |
DataFileWriter<D> |
setMeta(String key,
long value)
Set a metadata property. |
DataFileWriter<D> |
setMeta(String key,
String value)
Set a metadata property. |
DataFileWriter<D> |
setSyncInterval(int syncInterval)
Set the synchronization interval for this file, in bytes. |
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(DatumWriter<D> dout)
Method Detail |
---|
public DataFileWriter<D> setCodec(CodecFactory c)
public DataFileWriter<D> setSyncInterval(int syncInterval)
syncInterval
- the approximate number of uncompressed bytes to write in each block
public DataFileWriter<D> create(Schema schema, File file) throws IOException
IOException
public DataFileWriter<D> create(Schema schema, OutputStream outs) throws IOException
IOException
public DataFileWriter<D> appendTo(File file) throws IOException
IOException
public DataFileWriter<D> setMeta(String key, byte[] value)
public static boolean isReservedMeta(String key)
public DataFileWriter<D> setMeta(String key, String value)
public DataFileWriter<D> setMeta(String key, long value)
public void append(D datum) throws IOException
IOException
public void appendEncoded(ByteBuffer datum) throws IOException
IOException
public void appendAllFrom(DataFileStream<D> otherFile, boolean recompress) throws IOException
otherFile
- recompress
-
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
flush
in interface Flushable
IOException
public void close() throws IOException
close
in interface Closeable
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |