Class LinePipedInputStream
java.lang.Object
java.io.InputStream
java.io.PipedInputStream
org.aesh.terminal.tty.utils.LinePipedInputStream
- All Implemented Interfaces:
Closeable, AutoCloseable
A PipedInputStream that reads data line by line, stopping at newline characters.
- Author:
- Stale W. Pedersen
-
Field Summary
Fields inherited from class PipedInputStream
buffer, in, out, PIPE_SIZE -
Constructor Summary
ConstructorsConstructorDescriptionLinePipedInputStream(int pipeSize) Creates a new LinePipedInputStream with the specified pipe size.Creates a new LinePipedInputStream connected to the specified PipedOutputStream. -
Method Summary
Modifier and TypeMethodDescriptionintread(byte[] b, int off, int len) Reads up to len bytes of data from this input stream into an array of bytes.Methods inherited from class InputStream
mark, markSupported, read, reset, skip
-
Constructor Details
-
LinePipedInputStream
public LinePipedInputStream(int pipeSize) Creates a new LinePipedInputStream with the specified pipe size.- Parameters:
pipeSize- the size of the pipe buffer
-
LinePipedInputStream
Creates a new LinePipedInputStream connected to the specified PipedOutputStream.- Parameters:
src- the piped output stream to connect to- Throws:
IOException- if an I/O error occurs
-
-
Method Details
-
read
Reads up to len bytes of data from this input stream into an array of bytes. This method reads one line at a time, stopping when a newline character is encountered.- Overrides:
readin classPipedInputStream- Parameters:
b- the buffer into which the data is readoff- the start offset in array b at which the data is writtenlen- the maximum number of bytes to read- Returns:
- the total number of bytes read into the buffer, or -1 if there is no more data
- Throws:
IOException- if an I/O error occurs
-