Interface Document

    • Method Detail

      • title

        CharSequence title()
        The title of this document.
        Returns:
        the title to be used to refer to this document.
      • uri

        CharSequence uri()
        A URI that is associated with this document.
        Returns:
        the URI associated with this document, or null.
      • content

        Object content​(int field)
                throws IOException
        Returns the content of the given field.
        Parameters:
        field - the field index.
        Returns:
        the field content; the actual type depends on the field type, as specified by the DocumentFactory that built this document. For example, the returned object is going to be a Reader if the field type is DocumentFactory.FieldType.TEXT.
        Throws:
        IOException
      • wordReader

        WordReader wordReader​(int field)
        Returns a word reader for the given DocumentFactory.FieldType.TEXT field.
        Parameters:
        field - the field index.
        Returns:
        a word reader object that should be used to break the given field.
      • close

        void close()
            throws IOException
        Closes this document, releasing all resources.

        You should always call this method after manipulating a document. Implementations are invited to call this method in a finaliser as a safety net (even better, implement SafelyCloseable), but since there is no guarantee as to when finalisers are invoked, you should not depend on this behaviour.

        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface Closeable
        Throws:
        IOException