Package it.unimi.di.big.mg4j.document
Class CompositeDocumentFactory.CompositeDocument
- java.lang.Object
-
- it.unimi.di.big.mg4j.document.AbstractDocument
-
- it.unimi.di.big.mg4j.document.CompositeDocumentFactory.CompositeDocument
-
- All Implemented Interfaces:
Document,SafelyCloseable,Closeable,AutoCloseable
- Enclosing class:
- CompositeDocumentFactory
protected class CompositeDocumentFactory.CompositeDocument extends AbstractDocument
A document obtained by composition of documents of underyling factories.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedCompositeDocument(Reference2ObjectMap<Enum<?>,Object> metadata, InputStream rawContent)
-
Method Summary
Modifier and Type Method Description voidclose()Closes this document, releasing all resources.Objectcontent(int field)Returns the content of the given field.CharSequencetitle()The title of this document.StringtoString()CharSequenceuri()A URI that is associated with this document.WordReaderwordReader(int field)Returns a word reader for the givenDocumentFactory.FieldType.TEXTfield.-
Methods inherited from class it.unimi.di.big.mg4j.document.AbstractDocument
finalize
-
-
-
-
Constructor Detail
-
CompositeDocument
protected CompositeDocument(Reference2ObjectMap<Enum<?>,Object> metadata, InputStream rawContent) throws IOException
- Throws:
IOException
-
-
Method Detail
-
title
public CharSequence title()
Description copied from interface:DocumentThe title of this document.- Returns:
- the title to be used to refer to this document.
-
toString
public String toString()
- Overrides:
toStringin classAbstractDocument
-
uri
public CharSequence uri()
Description copied from interface:DocumentA URI that is associated with this document.- Returns:
- the URI associated with this document, or
null.
-
content
public Object content(int field) throws IOException
Description copied from interface:DocumentReturns 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
DocumentFactorythat built this document. For example, the returned object is going to be aReaderif the field type isDocumentFactory.FieldType.TEXT. - Throws:
IOException
-
wordReader
public WordReader wordReader(int field)
Description copied from interface:DocumentReturns a word reader for the givenDocumentFactory.FieldType.TEXTfield.- Parameters:
field- the field index.- Returns:
- a word reader object that should be used to break the given field.
-
close
public void close() throws IOExceptionDescription copied from interface:DocumentCloses 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:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceDocument- Overrides:
closein classAbstractDocument- Throws:
IOException
-
-