public class BinaryInputSplit extends FileInputSplit<byte[]>
FileInputSplit.InputSplitOpenThread
Modifier and Type | Field and Description |
---|---|
protected static int |
DEFAULT_RECORD_LENGTH
The default value of the record length
|
protected static java.lang.String |
RECORD_LENGTH
The configuration key to set the binary record length.
|
protected int |
recordLength
The length of a single record in the given binary file.
|
enumerateNestedFiles, MAX_SPLIT_SIZE_DISCREPANCY, minSplitSize, numSplits, openTimeout, splitLength, splitStart, stream
Constructor and Description |
---|
BinaryInputSplit(int num,
Path file,
int recordLen,
java.lang.String[] hosts) |
BinaryInputSplit(int num,
Path file,
long start,
long length,
java.lang.String[] hosts)
Constructs a split with host information.
|
Modifier and Type | Method and Description |
---|---|
void |
configure(Config parameters)
Configures this input format by reading the path to the file from the configuration and setting
the record length
|
int |
getBufferSize() |
java.nio.ByteOrder |
getEndianess() |
int |
getRecordLength() |
byte[] |
nextRecord(byte[] record)
Reads the next record from the input.
|
void |
open()
Opens the given input split.
|
void |
open(Config cfg) |
boolean |
reachedEnd()
Method used to check if the end of the input is reached.
|
byte[] |
readRecord(byte[] reusable,
byte[] bytes,
int readOffset,
int numBytes)
Reads a single record from the binary file
|
void |
setBufferSize(int buffSize) |
void |
setEndianess(java.nio.ByteOrder order) |
void |
setRecordLength(int recordLen) |
close, equals, getLength, getMinSplitSize, getNumSplits, getPath, getStart, hashCode, isEnumerateNestedFiles, setEnumerateNestedFiles, setMinSplitSize, setNumSplits, toString
getHostnames, getSplitNumber
protected static final java.lang.String RECORD_LENGTH
protected static final int DEFAULT_RECORD_LENGTH
protected transient int recordLength
public BinaryInputSplit(int num, Path file, long start, long length, java.lang.String[] hosts)
num
- the number of this input splitfile
- the file namestart
- the position of the first byte in the file to processlength
- the number of bytes in the file to process (-1 is flag for "read whole file")hosts
- the list of hosts containing the block, possibly null
public BinaryInputSplit(int num, Path file, int recordLen, java.lang.String[] hosts)
public java.nio.ByteOrder getEndianess()
public void setEndianess(java.nio.ByteOrder order)
public int getBufferSize()
public void setBufferSize(int buffSize)
public int getRecordLength()
public void setRecordLength(int recordLen)
public void configure(Config parameters)
configure
in interface InputSplit<byte[]>
configure
in class FileInputSplit<byte[]>
parameters
- The configuration object to read the parameters from.public void open() throws java.io.IOException
open
in interface InputSplit<byte[]>
open
in class FileInputSplit<byte[]>
java.io.IOException
- Thrown, if the spit could not be opened due to an I/O problem.public void open(Config cfg) throws java.io.IOException
open
in interface InputSplit<byte[]>
open
in class FileInputSplit<byte[]>
java.io.IOException
public boolean reachedEnd()
InputSplit
When this method is called, the input format it guaranteed to be opened.
public byte[] nextRecord(byte[] record) throws java.io.IOException
InputSplit
When this method is called, the input format it guaranteed to be opened.
record
- Object that may be reused.java.io.IOException
- Thrown, if an I/O error occurred.public byte[] readRecord(byte[] reusable, byte[] bytes, int readOffset, int numBytes) throws java.io.IOException
java.io.IOException