Interface DocumentReader

  • All Known Implementing Classes:
    JacksonReader

    @ThreadSafe
    public interface DocumentReader
    Reads Document instances from a variety of input forms.
    Author:
    Randall Hauch
    • Method Detail

      • defaultReader

        static DocumentReader defaultReader()
        Get the default DocumentReader instance.
        Returns:
        the shared default reader instance; never null
      • floatNumbersAsTextReader

        static DocumentReader floatNumbersAsTextReader()
        Get DocumentReader instance that returns fp numbers as text.
        Returns:
        the shared default reader instance; never null
      • read

        Document read​(InputStream jsonStream)
               throws IOException
        Read a document from the supplied stream.
        Parameters:
        jsonStream - the input stream to be read; may not be null
        Returns:
        the document instance; never null
        Throws:
        IOException - if a document could not be read from the supplied stream
      • read

        Document read​(Reader jsonReader)
               throws IOException
        Read a document from the supplied Reader.
        Parameters:
        jsonReader - the reader to be read; may not be null
        Returns:
        the document instance; never null
        Throws:
        IOException - if a document could not be read from the supplied reader
      • read

        Document read​(String json)
               throws IOException
        Read a document from the supplied JSON-formatted string.
        Parameters:
        json - the JSON string representation to be read; may not be null
        Returns:
        the document instance; never null
        Throws:
        IOException - if a document could not be read from the supplied string
      • read

        default Document read​(URL jsonUrl)
                       throws IOException
        Read a document from the content at the given URL.
        Parameters:
        jsonUrl - the URL to the content that is to be read; may not be null
        Returns:
        the document instance; never null
        Throws:
        IOException - if a document could not be read from the supplied content
      • read

        default Document read​(File jsonFile)
                       throws IOException
        Read a document from the supplied file.
        Parameters:
        jsonFile - the file to be read; may not be null
        Returns:
        the document instance; never null
        Throws:
        IOException - if a document could not be read from the supplied file
      • read

        default Document read​(byte[] rawBytes)
                       throws IOException
        Read a document from the supplied bytes.
        Parameters:
        rawBytes - the UTF-8 bytes to be read; may not be null
        Returns:
        the document instance; never null
        Throws:
        IOException - if a document could not be read from the supplied bytes