Package com.illumon.iris.importers.util
Class FooterSkipBufferedReader
java.lang.Object
java.io.Reader
java.io.BufferedReader
com.illumon.iris.importers.util.FooterSkipBufferedReader
- All Implemented Interfaces:
Closeable,AutoCloseable,Readable
public class FooterSkipBufferedReader extends BufferedReader
-
Field Summary
-
Constructor Summary
Constructors Constructor Description FooterSkipBufferedReader(Reader in, int skipFooterLines)Creates a buffered reader usingFooterSkipBufferedReader(Reader, int, int)that will skip a specified number of rows at the end, using the default buffer size ofDEFAULT_BUFFER_SIZE.FooterSkipBufferedReader(Reader in, int skipFooterLines, int bufferSize)Creates a buffered reader that will skip a specified number of rows at the end, using the specified buffer size. -
Method Summary
Modifier and Type Method Description static intgetDefaultBufferSize()Returns the default buffer size, in characters, that will be used if no size is specified when the reader is createdStream<String>lines()Unsupported by the FooterSkipBufferedReadervoidmark(int readAheadLimit)Unsupported by the FooterSkipBufferedReaderbooleanmarkSupported()Tells whether this stream supports the mark() operation, which it does not.intread()Reads a single character up to the lines to be skipped as specified in the constructor.intread(char[] cbuf, int off, int len)StringreadLine()Reads a line of text.voidreset()Unsupported by the FooterSkipBufferedReaderlongskip(long n)Unsupported by the FooterSkipBufferedReader
-
Constructor Details
-
FooterSkipBufferedReader
Creates a buffered reader usingFooterSkipBufferedReader(Reader, int, int)that will skip a specified number of rows at the end, using the default buffer size ofDEFAULT_BUFFER_SIZE.- Parameters:
in- The InputStreamReader from which the buffered reader will readskipFooterLines- How many lines to skip at the end of processing
-
FooterSkipBufferedReader
Creates a buffered reader that will skip a specified number of rows at the end, using the specified buffer size.- Parameters:
in- The InputStreamReader from which the buffered reader will readskipFooterLines- How many lines to skip at the end of processingbufferSize- Size in characters (ints) of the buffer to use when reading the stream; this must be at least large enough to contain the entirety of the rows to be skipped.
-
-
Method Details
-
getDefaultBufferSize
public static int getDefaultBufferSize()Returns the default buffer size, in characters, that will be used if no size is specified when the reader is created- Returns:
- int value of the DEFAULT_BUFFER_SIZE defined for the class
-
read
- Overrides:
readin classBufferedReader- Throws:
IOException
-
read
Reads a single character up to the lines to be skipped as specified in the constructor.- Overrides:
readin classBufferedReader- Returns:
- The character read, as an integer in the range 0 to 65535 (0x00-0xffff), or -1 if the end of the stream has been reached
- Throws:
IOException- If an I/O error occurs
-
readLine
Reads a line of text. A line is considered to be terminated by any one of a line feed ('\n'), a carriage return ('\r'), a carriage return followed immediately by a line feed, or by reaching the end-of-file (EOF).- Overrides:
readLinein classBufferedReader- Returns:
- A String containing the contents of the line, not including any line-termination characters, or null if the end of the stream has been reached without reading any characters
- Throws:
IOException- If an I/O error occurs- See Also:
Files.readAllLines(java.nio.file.Path, java.nio.charset.Charset)
-
skip
public long skip(long n)Unsupported by the FooterSkipBufferedReader- Overrides:
skipin classBufferedReader
-
markSupported
public boolean markSupported()Tells whether this stream supports the mark() operation, which it does not.- Overrides:
markSupportedin classBufferedReader
-
mark
public void mark(int readAheadLimit)Unsupported by the FooterSkipBufferedReader- Overrides:
markin classBufferedReader
-
reset
public void reset()Unsupported by the FooterSkipBufferedReader- Overrides:
resetin classBufferedReader
-
lines
Unsupported by the FooterSkipBufferedReader- Overrides:
linesin classBufferedReader
-