Class FixedLengthBufferedReader

java.lang.Object
java.io.Reader
java.io.BufferedReader
overit.geocall.util.FixedLengthBufferedReader
All Implemented Interfaces:
Closeable, AutoCloseable, Readable

public class FixedLengthBufferedReader extends BufferedReader
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 Details

    • _fieldsLength

      protected int[] _fieldsLength
  • Constructor Details

    • FixedLengthBufferedReader

      public FixedLengthBufferedReader(Reader in)
      Creates a buffering character-input stream that uses a default-sized input buffer.
      Parameters:
      in - A Reader
    • FixedLengthBufferedReader

      public FixedLengthBufferedReader(Reader in, int sz)
      Creates a buffering character-input stream that uses an input buffer of the specified size.
      Parameters:
      in - A Reader
      sz - The size of the input buffer
  • Method Details

    • setFiledsLength

      @Deprecated public void setFiledsLength(int[] length)
      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

      public ArrayList readFixedLine() throws IOException
      Reads a line of text and returns an ArrayList containing the string portions of the length defined by the method setFieldsLength(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