public class CSVInputSplit extends FileInputSplit<java.lang.Object>
FileInputSplit.InputSplitOpenThread
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_FIELD_DELIMITER |
static java.lang.String |
DEFAULT_LINE_DELIMITER |
static java.lang.String |
DEFAULT_TAB_DELIMITER |
protected static java.lang.String |
RECORD_DELIMITER
The configuration key to set the record delimiter.
|
enumerateNestedFiles, MAX_SPLIT_SIZE_DISCREPANCY, minSplitSize, numSplits, openTimeout, splitLength, splitStart, stream
Constructor and Description |
---|
CSVInputSplit(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 |
close()
Closes the input by releasing all buffers and closing the file input stream.
|
void |
configure(Config parameters)
Configures this input format by reading the path to the file from the
configuration and the string that
defines the record delimiter.
|
int |
getBufferSize() |
java.nio.charset.Charset |
getCharset()
Get the character set used for the row delimiter.
|
java.lang.String |
getCharsetName() |
byte[] |
getDelimiter() |
java.lang.String |
getDelimiterString() |
int |
getLineLengthLimit() |
java.lang.String |
nextRecord(java.lang.Object record)
Reads the next record from the input.
|
void |
open(Config cfg)
Opens the given input split.
|
boolean |
reachedEnd()
Checks whether the current split is at its end.
|
protected boolean |
readLine() |
java.lang.String |
readRecord(byte[] bytes,
int readOffset,
int numBytes) |
void |
setBufferSize(int bufferSize) |
void |
setCharsetName(java.lang.String charsetName) |
void |
setDelimiter(byte[] delimiter) |
void |
setDelimiterString(java.lang.String delimiterString) |
void |
setLineLengthLimit(int lineLengthLimit) |
equals, getLength, getMinSplitSize, getNumSplits, getPath, getStart, hashCode, isEnumerateNestedFiles, open, setEnumerateNestedFiles, setMinSplitSize, setNumSplits, toString
getHostnames, getSplitNumber
public static final java.lang.String DEFAULT_LINE_DELIMITER
public static final java.lang.String DEFAULT_FIELD_DELIMITER
public static final java.lang.String DEFAULT_TAB_DELIMITER
protected static final java.lang.String RECORD_DELIMITER
public CSVInputSplit(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 byte[] getDelimiter()
public void setDelimiter(byte[] delimiter)
public java.lang.String getDelimiterString()
public void setDelimiterString(java.lang.String delimiterString)
public int getBufferSize()
public void setBufferSize(int bufferSize)
public java.lang.String getCharsetName()
public void setCharsetName(java.lang.String charsetName)
public int getLineLengthLimit()
public void setLineLengthLimit(int lineLengthLimit)
public java.nio.charset.Charset getCharset()
public void configure(Config parameters)
configure
in interface InputSplit<java.lang.Object>
configure
in class FileInputSplit<java.lang.Object>
parameters
- The configuration object to read the parameters from.public void open(Config cfg) throws java.io.IOException
open
in interface InputSplit<java.lang.Object>
open
in class FileInputSplit<java.lang.Object>
java.io.IOException
public java.lang.String nextRecord(java.lang.Object 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 java.lang.String readRecord(byte[] bytes, int readOffset, int numBytes) throws java.io.IOException
java.io.IOException
protected final boolean readLine() throws java.io.IOException
java.io.IOException
public void close() throws java.io.IOException
close
in interface InputSplit<java.lang.Object>
close
in class FileInputSplit<java.lang.Object>
java.io.IOException
- Thrown, if the closing of the file stream causes an I/O error.public boolean reachedEnd()