Interface IDocumentContentReader


  • public interface IDocumentContentReader

    Provides methods to read the content of a document.

    Example:
    String content = document.read().asIvyFile().read();
    String content = document.read().useEncoding("UTF-8").asString();

    API:
    This is a public API.
    • Method Detail

      • useEncoding

        IDocumentContentReader useEncoding​(String encoding)
        Sets the encoding that will be used by the methods asString() and asReader() to decode the content.
        Parameters:
        encoding -
        Returns:
        document content reader
        See Also:
        asString(), asReader()
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
      • useEncoding

        IDocumentContentReader useEncoding​(Charset encoding)
        Sets the encoding that will be used by the methods asString() and asReader() to decode the content.
        Parameters:
        encoding -
        Returns:
        document content reader
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
      • asJavaFile

        File asJavaFile()
        Returns:
        java file that holds the content of the document
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
      • asIvyFile

        File asIvyFile()

        Example:
        File file = document.read().asIvyFile();
        String content = file.read();

        Returns:
        ivy file that holds the content of the document
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • asString

        String asString()
        Get a string with the content of the document. If an encoding is set it will be used to decode the content.

        Example:
        String content = document.read().asString();

        Returns:
        content as string
        See Also:
        useEncoding(Charset), useEncoding(String)
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • asReader

        Reader asReader()
        Get a reader that delivers the content of the document. If an encoding is set it will be used to decode the content.
        Returns:
        reader
        See Also:
        useEncoding(Charset), useEncoding(String)
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
      • asBinary

        Binary asBinary()

        Example:
        Binary content = document.read().asBinary();

        Returns:
        binary with the content of the document
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • asStream

        InputStream asStream()
        Returns:
        input stream that delivers the content of the document
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.