|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.hadoop.util.LineReader
public class LineReader
A class that provides a line reader from an input stream.
Constructor Summary | |
---|---|
LineReader(InputStream in)
Create a line reader that reads from the given stream using the default buffer-size (64k). |
|
LineReader(InputStream in,
Configuration conf)
Create a line reader that reads from the given stream using the io.file.buffer.size specified in the given
Configuration . |
|
LineReader(InputStream in,
int bufferSize)
Create a line reader that reads from the given stream using the given buffer-size. |
Method Summary | |
---|---|
void |
close()
Close the underlying stream. |
int |
readLine(Text str)
Read from the InputStream into the given Text. |
int |
readLine(Text str,
int maxLineLength)
Read from the InputStream into the given Text. |
int |
readLine(Text str,
int maxLineLength,
int maxBytesToConsume)
Read one line from the InputStream into the given Text. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LineReader(InputStream in)
in
- The input stream
IOException
public LineReader(InputStream in, int bufferSize)
in
- The input streambufferSize
- Size of the read buffer
IOException
public LineReader(InputStream in, Configuration conf) throws IOException
io.file.buffer.size
specified in the given
Configuration
.
in
- input streamconf
- configuration
IOException
Method Detail |
---|
public void close() throws IOException
IOException
public int readLine(Text str, int maxLineLength, int maxBytesToConsume) throws IOException
str
- the object to store the given line (without newline)maxLineLength
- the maximum number of bytes to store into str;
the rest of the line is silently discarded.maxBytesToConsume
- the maximum number of bytes to consume
in this call. This is only a hint, because if the line cross
this threshold, we allow it to happen. It can overshoot
potentially by as much as one buffer length.
IOException
- if the underlying stream throwspublic int readLine(Text str, int maxLineLength) throws IOException
str
- the object to store the given linemaxLineLength
- the maximum number of bytes to store into str.
IOException
- if the underlying stream throwspublic int readLine(Text str) throws IOException
str
- the object to store the given line
IOException
- if the underlying stream throws
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |