Interface DataFormatReader

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean canRead​(java.io.Reader reader, int readLimit)
      Returns true if this reader estimates to be able to consume the input data.
      java.lang.Object readInput​(java.io.Reader reader)
      Read (or parse) a reader into this data format's input structure.
    • Method Detail

      • canRead

        boolean canRead​(java.io.Reader reader,
                        int readLimit)
        Returns true if this reader estimates to be able to consume the input data. Implementations may not read more than readLimit bytes from the supplied reader.
        Parameters:
        reader - reader that can be read from to detect a data format
        readLimit - positive number that poses a restriction on how many characters an implementation may read. Reading beyond this limit may lead to incomplete input when the method readInput(Reader) is invoked.
        Returns:
        true if this reader is able to consume the input
      • readInput

        java.lang.Object readInput​(java.io.Reader reader)
        Read (or parse) a reader into this data format's input structure. For example, an Xml-Based data format may return an internal tree structure which can be used for traversing the xml tree.
        Parameters:
        reader - a Reader providing the data source
        Returns:
        the read or parsed input
        Throws:
        SpinDataFormatException - in case the reader cannot read the input