@InterfaceAudience.Private @InterfaceStability.Unstable public static class IFile.Reader extends Object
IFile.Reader
to read intermediate map-outputs.Modifier and Type | Class and Description |
---|---|
static class |
IFile.Reader.KeyState |
Modifier and Type | Field and Description |
---|---|
protected byte[] |
buffer |
protected int |
bufferSize |
long |
bytesRead |
protected int |
currentKeyLength |
protected int |
currentValueLength |
protected DataInputStream |
dataIn |
protected boolean |
eof |
protected int |
originalKeyLength |
protected int |
prevKeyLength |
protected int |
recNo |
Constructor and Description |
---|
IFile.Reader(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path file,
org.apache.hadoop.io.compress.CompressionCodec codec,
org.apache.tez.common.counters.TezCounter readsCounter,
org.apache.tez.common.counters.TezCounter bytesReadCounter,
boolean ifileReadAhead,
int ifileReadAheadLength,
int bufferSize)
Construct an IFile Reader.
|
IFile.Reader(InputStream in,
long length,
org.apache.hadoop.io.compress.CompressionCodec codec,
org.apache.tez.common.counters.TezCounter readsCounter,
org.apache.tez.common.counters.TezCounter bytesReadCounter,
boolean readAhead,
int readAheadLength,
int bufferSize)
Construct an IFile Reader.
|
IFile.Reader(InputStream in,
long length,
org.apache.hadoop.io.compress.CompressionCodec codec,
org.apache.tez.common.counters.TezCounter readsCounter,
org.apache.tez.common.counters.TezCounter bytesReadCounter,
boolean readAhead,
int readAheadLength,
int bufferSize,
boolean isCompressed)
Construct an IFile Reader.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
disableChecksumValidation() |
long |
getLength() |
long |
getPosition() |
static boolean |
isCompressedFlagEnabled(InputStream in) |
boolean |
nextRawKey(org.apache.hadoop.io.DataInputBuffer key) |
void |
nextRawValue(org.apache.hadoop.io.DataInputBuffer value) |
protected boolean |
positionToNextRecord(DataInput dIn)
Reset key length and value length for next record in the file
|
protected void |
readKeyValueLength(DataInput dIn) |
IFile.Reader.KeyState |
readRawKey(org.apache.hadoop.io.DataInputBuffer key) |
static void |
readToMemory(byte[] buffer,
InputStream in,
int compressedLength,
org.apache.hadoop.io.compress.CompressionCodec codec,
boolean ifileReadAhead,
int ifileReadAheadLength)
Read entire ifile content to memory.
|
protected void |
readValueLength(DataInput dIn) |
void |
reset(int offset) |
public long bytesRead
protected boolean eof
protected byte[] buffer
protected int bufferSize
protected DataInputStream dataIn
protected int recNo
protected int originalKeyLength
protected int prevKeyLength
protected int currentKeyLength
protected int currentValueLength
public IFile.Reader(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path file, org.apache.hadoop.io.compress.CompressionCodec codec, org.apache.tez.common.counters.TezCounter readsCounter, org.apache.tez.common.counters.TezCounter bytesReadCounter, boolean ifileReadAhead, int ifileReadAheadLength, int bufferSize) throws IOException
fs
- FileSystemfile
- Path of the file to be opened. This file should have
checksum bytes for the data at the end of the file.codec
- codecreadsCounter
- Counter for records read from diskIOException
public IFile.Reader(InputStream in, long length, org.apache.hadoop.io.compress.CompressionCodec codec, org.apache.tez.common.counters.TezCounter readsCounter, org.apache.tez.common.counters.TezCounter bytesReadCounter, boolean readAhead, int readAheadLength, int bufferSize) throws IOException
in
- The input streamlength
- Length of the data in the stream, including the checksum
bytes.codec
- codecreadsCounter
- Counter for records read from diskIOException
public IFile.Reader(InputStream in, long length, org.apache.hadoop.io.compress.CompressionCodec codec, org.apache.tez.common.counters.TezCounter readsCounter, org.apache.tez.common.counters.TezCounter bytesReadCounter, boolean readAhead, int readAheadLength, int bufferSize, boolean isCompressed) throws IOException
in
- The input streamlength
- Length of the data in the stream, including the checksum
bytes.codec
- codecreadsCounter
- Counter for records read from diskIOException
public static void readToMemory(byte[] buffer, InputStream in, int compressedLength, org.apache.hadoop.io.compress.CompressionCodec codec, boolean ifileReadAhead, int ifileReadAheadLength) throws IOException
buffer
- in
- compressedLength
- codec
- ifileReadAhead
- ifileReadAheadLength
- IOException
public long getLength()
public long getPosition() throws IOException
IOException
protected void readValueLength(DataInput dIn) throws IOException
IOException
protected void readKeyValueLength(DataInput dIn) throws IOException
IOException
protected boolean positionToNextRecord(DataInput dIn) throws IOException
dIn
- IOException
public final boolean nextRawKey(org.apache.hadoop.io.DataInputBuffer key) throws IOException
IOException
public IFile.Reader.KeyState readRawKey(org.apache.hadoop.io.DataInputBuffer key) throws IOException
IOException
public void nextRawValue(org.apache.hadoop.io.DataInputBuffer value) throws IOException
IOException
public static boolean isCompressedFlagEnabled(InputStream in) throws IOException
IOException
public void close() throws IOException
IOException
public void reset(int offset)
public void disableChecksumValidation()
Copyright © 2016 Apache Software Foundation. All rights reserved.