Package 

Class HCReader

  • All Implemented Interfaces:
    java.io.Closeable , java.lang.AutoCloseable

    
    public final class HCReader
     implements Closeable
                        

    Provides convenience methods to parse the input data, with clear error handling and line numbering.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private final Integer lineNumber
    • Constructor Summary

      Constructors 
      Constructor Description
      HCReader(Reader reader, Regex tokenDelimiter)
    • Method Summary

      Modifier and Type Method Description
      final Unit skip(Integer n) Skips the next n tokens of input.
      final String readString() Reads the next token of the input as a string.
      final Integer readInt() Reads the next token of the input as an int.
      final Double readDouble() Reads the next token of the input as a double.
      final Boolean readBoolean() Reads the next token of the input as a boolean.
      final String nextLineText() Reads and returns the whole next line of input.
      final List<String> nextLineTokens() Reads and returns the next line of input as a list of strings.
      Unit close() Releases potential resources used by the reader.
      final Integer getLineNumber()
      • Methods inherited from class java.lang.AutoCloseable

        equals, hashCode, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HCReader

        HCReader(Reader reader, Regex tokenDelimiter)
        Parameters:
        reader - the reader to use to read the input
        tokenDelimiter - the delimiter to use to separate tokens