@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 static int |
MAX_BUFFER_SIZE |
protected int |
originalKeyLength |
protected int |
prevKeyLength |
protected int |
recNo |
| Constructor and Description |
|---|
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.
|
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.
|
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 long |
readToDisk(OutputStream out,
InputStream in,
long length,
boolean ifileReadAhead,
int ifileReadAheadLength)
Read entire IFile content to disk.
|
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) |
protected static int MAX_BUFFER_SIZE
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 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 diskIOExceptionpublic 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 diskIOExceptionpublic 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 diskIOExceptionpublic 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 - IOExceptionpublic static long readToDisk(OutputStream out, InputStream in, long length, boolean ifileReadAhead, int ifileReadAheadLength) throws IOException
out - the output stream that will receive the datain - the input stream containing the IFile datalength - the amount of data to read from the inputIOExceptionpublic long getLength()
public long getPosition()
throws IOException
IOExceptionprotected void readValueLength(DataInput dIn) throws IOException
IOExceptionprotected void readKeyValueLength(DataInput dIn) throws IOException
IOExceptionprotected boolean positionToNextRecord(DataInput dIn) throws IOException
dIn - IOExceptionpublic final boolean nextRawKey(org.apache.hadoop.io.DataInputBuffer key)
throws IOException
IOExceptionpublic IFile.Reader.KeyState readRawKey(org.apache.hadoop.io.DataInputBuffer key) throws IOException
IOExceptionpublic void nextRawValue(org.apache.hadoop.io.DataInputBuffer value)
throws IOException
IOExceptionpublic static boolean isCompressedFlagEnabled(InputStream in) throws IOException
IOExceptionpublic void close()
throws IOException
IOExceptionpublic void reset(int offset)
public void disableChecksumValidation()
Copyright © 2017 Apache Software Foundation. All rights reserved.