DataFileWriter.
DataFileWriter
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class |
| Modifier and Type | Field and Description |
|---|---|
| private long | |
| private int[] | |
| private DataFileReader. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| private | |
| protected | DataFileReader(SeekableInput sin, DatumReader<D> reader, boolean closeOnError, byte[] magic)
Construct a reader for a file. |
| protected | DataFileReader(SeekableInput sin, DatumReader<D> reader, DataFileStream.
Construct using a |
| Modifier and Type | Method and Description |
|---|---|
| protected void | |
| private int[] | Returns: the pre-computed partial match tableThe pattern being searched pattern)Compute that Knuth-Morris-Pratt partial match table. |
| public static <D> FileReader | |
| public static <D> FileReader | |
| public static <D> DataFileReader | openReader(SeekableInput in, DatumReader<D> reader, DataFileStream.
True to read forward to the next sync point after opening, false
to assume that the input is already at a valid sync point. sync)Construct a reader for a file at the current position of the input, without reading the header. |
| public boolean | pastSync(long position)
Implements org. |
| public long | |
| public void | seek(long position)
Move to a specific, known synchronization point, one returned from
|
| public void | sync(final long position)
Implements org. |
| public long |
| blockStart | back to summary |
|---|---|
| private long blockStart | |
| partialMatchTable | back to summary |
|---|---|
| private int[] partialMatchTable | |
| sin | back to summary |
|---|---|
| private DataFileReader. | |
| DataFileReader | back to summary |
|---|---|
| public DataFileReader(File file, DatumReader<D> reader) throws IOException Construct a reader for a file. For example, if you want to read a file record,you need to close the resource. You can use try-with-resource as follows:
try (FileReader<User> dataFileReader =
DataFileReader.openReader(file,datumReader)) { //Consume the reader } catch
(IOException e) { throw new RunTimeIOException(e,"Failed to read metadata for
file: %s", file); }
| |
| DataFileReader | back to summary |
|---|---|
| public DataFileReader(SeekableInput sin, DatumReader<D> reader) throws IOException Construct a reader for a file. For example, if you want to read a file record,you need to close the resource. You can use try-with-resource as follows:
try (FileReader<User> dataFileReader =
DataFileReader.openReader(file,datumReader)) { //Consume the reader } catch
(IOException e) { throw new RunTimeIOException(e,"Failed to read metadata for
file: %s", file); }
| |
| DataFileReader | back to summary |
|---|---|
| private DataFileReader(SeekableInput sin, DatumReader<D> reader, byte[] magic) throws IOException | |
| DataFileReader | back to summary |
|---|---|
| protected DataFileReader(SeekableInput sin, DatumReader<D> reader, boolean closeOnError, byte[] magic) throws IOException Construct a reader for a file. Please close resource files yourself. | |
| DataFileReader | back to summary |
|---|---|
| protected DataFileReader(SeekableInput sin, DatumReader<D> reader, DataFileStream. Construct using a | |
| blockFinished | back to summary |
|---|---|
| protected void blockFinished() throws IOException Overrides org.
| |
| computePartialMatchTable | back to summary |
|---|---|
| private int[] computePartialMatchTable(final byte[] pattern) Compute that Knuth-Morris-Pratt partial match table.
| |
| openReader | back to summary |
|---|---|
| public static <D> FileReader Open a reader for a file. | |
| openReader | back to summary |
|---|---|
| public static <D> FileReader Open a reader for a file. | |
| openReader | back to summary |
|---|---|
| public static <D> DataFileReader Construct a reader for a file at the current position of the input, without reading the header.
| |
| pastSync | back to summary |
|---|---|
| public boolean pastSync(long position) throws IOException Implements org. Return true if past the next synchronization point after a position.
| |
| previousSync | back to summary |
|---|---|
| public long previousSync() Return the last synchronization point before our current position. | |
| seek | back to summary |
|---|---|
| public void seek(long position) throws IOException Move to a specific, known synchronization point, one returned from
| |
| sync | back to summary |
|---|---|
| public void sync(final long position) throws IOException Implements org. Move to the next synchronization point after a position. To process a range
of file entires, call this with the starting position, then check
| |
| tell | back to summary |
|---|---|
| public long tell() throws IOException Implements org. Doc from org. Return the current position in the input.
| |
| Modifier and Type | Field and Description |
|---|---|
| private SeekableInput | |
| private final byte[] |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public int | available()
Overrides java. |
| public void | close()
Overrides java. Implements java. |
| public long | |
| public int | read(byte[]
the buffer into which the data is read. b)Overrides java. b.
|
| public int | read(byte[]
the buffer into which the data is read. b, int the start offset in array off, int b
at which the data is written.the maximum number of bytes to read. len)Overrides java. Implements org. java..
|
| public int | read()
Implements abstract java. |
| public void | seek(long p)
Implements org. read().
|
| public long | skip(long
the number of bytes to be skipped. skip)Overrides java. n bytes of data from this input
stream.
|
| public long |
| in | back to summary |
|---|---|
| private SeekableInput in | |
| oneByte | back to summary |
|---|---|
| private final byte[] oneByte | |
| SeekableInputStream | back to summary |
|---|---|
| pack-priv SeekableInputStream(SeekableInput in) throws IOException | |
| available | back to summary |
|---|---|
| public int available() throws IOException Overrides java. Doc from java. Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking, which may be 0, or 0 when end of stream is detected. The read might be on the same thread or another thread. A single read or skip of this many bytes will not block, but may read or skip fewer bytes. Note that while some implementations of A subclass's implementation of this method may choose to throw an
| |
| close | back to summary |
|---|---|
| public void close() throws IOException Overrides java. Implements java. Doc from java. Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect. As noted in
| |
| length | back to summary |
|---|---|
| public long length() throws IOException Implements org. Doc from org. Return the length of the file.
| |
| read | back to summary |
|---|---|
| public int read(byte[] b) throws IOException Overrides java. Doc from java. Reads some number of bytes from the input stream and stores them into
the buffer array If the length of The first byte read is stored into element
| |
| read | back to summary |
|---|---|
| public int read(byte[] b, int off, int len) throws IOException Overrides java. Implements org. Doc from org. Equivalent to
| |
| read | back to summary |
|---|---|
| public int read() throws IOException Implements abstract java. Doc from java. Reads the next byte of data from the input stream. The value byte is
returned as an
| |
| seek | back to summary |
|---|---|
| public void seek(long p) throws IOException Implements org. Doc from org. Set the position for the next
| |
| skip | back to summary |
|---|---|
| public long skip(long skip) throws IOException Overrides java. Doc from java. Skips over and discards
| |
| tell | back to summary |
|---|---|
| public long tell() throws IOException Implements org. Doc from org. Return the position of the next
| |