public class DataFileStream<D> extends Object implements Iterator<D>, Iterable<D>, Closeable
DataFileWriter
. Use DataFileReader
for file-based input.DataFileWriter
Modifier and Type | Class and Description |
---|---|
static class |
DataFileStream.Header
A handle that can be used to reopen a DataFile without re-reading the
header of the stream.
|
Modifier | Constructor and Description |
---|---|
protected |
DataFileStream(DatumReader<D> reader)
create an unitialized DataFileStream
|
|
DataFileStream(InputStream in,
DatumReader<D> reader)
Construct a reader for an input stream.
|
Modifier and Type | Method and Description |
---|---|
protected void |
blockFinished() |
void |
close()
Close this reader.
|
long |
getBlockCount()
Expert: Return the count of items in the current block.
|
DataFileStream.Header |
getHeader()
A handle that can be used to reopen this stream without rereading the
head.
|
byte[] |
getMeta(String key)
Return the value of a metadata property.
|
List<String> |
getMetaKeys()
Return the list of keys in the metadata
|
long |
getMetaLong(String key)
Return the value of a metadata property.
|
String |
getMetaString(String key)
Return the value of a metadata property.
|
Schema |
getSchema()
Return the schema used in this file.
|
boolean |
hasNext()
True if more entries remain in this file.
|
Iterator<D> |
iterator()
Returns an iterator over entries in this file.
|
D |
next()
Read the next datum in the file.
|
D |
next(D reuse)
Read the next datum from the file.
|
ByteBuffer |
nextBlock()
Expert: Return the next block in the file, as binary-encoded data.
|
void |
remove()
Not supported.
|
public DataFileStream(InputStream in, DatumReader<D> reader) throws IOException
DataFileReader
. This will buffer, wrapping with a
BufferedInputStream
is not necessary.IOException
protected DataFileStream(DatumReader<D> reader) throws IOException
IOException
public DataFileStream.Header getHeader()
public Schema getSchema()
public byte[] getMeta(String key)
public long getMetaLong(String key)
public Iterator<D> iterator()
public boolean hasNext()
public D next()
next
in interface Iterator<D>
NoSuchElementException
- if no more remain in the file.public D next(D reuse) throws IOException
reuse
- an instance to reuse.NoSuchElementException
- if no more remain in the file.IOException
public ByteBuffer nextBlock() throws IOException
IOException
public long getBlockCount()
protected void blockFinished() throws IOException
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
Copyright © 2009-2012 The Apache Software Foundation. All Rights Reserved.