Interface DataFormatReader

All Known Implementing Classes:
DomXmlDataFormatReader, JacksonJsonDataFormatReader, TextBasedDataFormatReader

public interface DataFormatReader
Reads the internal representation of a Spin object from its serialized representation.
Author:
Daniel Meyer, Sebastian Menski, Thorben Lindhauer
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canRead(Reader reader, int readLimit)
    Returns true if this reader estimates to be able to consume the input data.
    readInput(Reader reader)
    Read (or parse) a reader into this data format's input structure.
  • Method Details

    • canRead

      boolean canRead(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

      Object readInput(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