Package overit.geocall.util
Class FixedLengthBufferedReader
java.lang.Object
java.io.Reader
java.io.BufferedReader
overit.geocall.util.FixedLengthBufferedReader
- All Implemented Interfaces:
Closeable,AutoCloseable,Readable
This class, which extends the
BufferedReader, is an utility implementation that must be used if you want to read
the contents of an input reader in order to obtain a list readFixedLine(), containing portions of this input,
of predefined lengths, even different setFieldsLength(int[]).-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a buffering character-input stream that uses a default-sized input buffer.FixedLengthBufferedReader(Reader in, int sz) Creates a buffering character-input stream that uses an input buffer of the specified size. -
Method Summary
Modifier and TypeMethodDescriptionReads a line of text and returns anArrayListcontaining the string portions of the length defined by the methodsetFieldsLength(int[])voidsetFieldsLength(int[] length) Sets the lengths of the string portions to be readvoidsetFiledsLength(int[] length) Deprecated.Methods inherited from class java.io.BufferedReader
close, lines, mark, markSupported, read, read, readLine, ready, reset, skipMethods inherited from class java.io.Reader
nullReader, read, read, transferTo
-
Field Details
-
_fieldsLength
protected int[] _fieldsLength
-
-
Constructor Details
-
FixedLengthBufferedReader
Creates a buffering character-input stream that uses a default-sized input buffer.- Parameters:
in- AReader
-
FixedLengthBufferedReader
Creates a buffering character-input stream that uses an input buffer of the specified size.- Parameters:
in- AReadersz- The size of the input buffer
-
-
Method Details
-
setFiledsLength
Deprecated.- Parameters:
length- An array of integer in which each value represents the length of the portion of string to be read
-
setFieldsLength
public void setFieldsLength(int[] length) Sets the lengths of the string portions to be read- Parameters:
length- An array of integer in which each value represents the length of the portion of string to be read
-
readFixedLine
Reads a line of text and returns anArrayListcontaining the string portions of the length defined by the methodsetFieldsLength(int[])- Returns:
- An ArrayList containing the string portions readed from the input
- Throws:
IOException- If an error occurs during the operation, an IOException is thrown
-