Class CSVDocumentCollection
- java.lang.Object
-
- it.unimi.di.big.mg4j.document.AbstractDocumentSequence
-
- it.unimi.di.big.mg4j.document.CSVDocumentCollection
-
- All Implemented Interfaces:
DocumentSequence,SafelyCloseable,Closeable,Serializable,AutoCloseable
public class CSVDocumentCollection extends AbstractDocumentSequence implements Serializable
ADocumentCollectioncorresponding to a given set of records in a comma separated file.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CSVDocumentCollection(String fileName, String separator, String[] column, int titleColumn, DocumentFactory factory)
-
Method Summary
Modifier and Type Method Description voidclose()Closes this document sequence, releasing all resources.DocumentFactoryfactory()Returns the factory used by this sequence.DocumentIteratoriterator()Returns an iterator over the sequence of documents.static voidmain(String[] arg)-
Methods inherited from class it.unimi.di.big.mg4j.document.AbstractDocumentSequence
filename, finalize, load
-
-
-
-
Constructor Detail
-
CSVDocumentCollection
public CSVDocumentCollection(String fileName, String separator, String[] column, int titleColumn, DocumentFactory factory) throws FileNotFoundException
- Throws:
FileNotFoundException
-
-
Method Detail
-
iterator
public DocumentIterator iterator()
Description copied from interface:DocumentSequenceReturns an iterator over the sequence of documents.Warning: this method can be safely called just one time. For instance, implementations based on standard input will usually throw an exception if this method is called twice.
Implementations may decide to override this restriction (in particular, if they implement
DocumentCollection). Usually, however, it is not possible to obtain two iterators at the same time on a collection.- Specified by:
iteratorin interfaceDocumentSequence- Returns:
- an iterator over the sequence of documents.
- See Also:
DocumentCollection
-
factory
public DocumentFactory factory()
Description copied from interface:DocumentSequenceReturns the factory used by this sequence.Every document sequence is based on a document factory that transforms raw bytes into a sequence of characters. The factory contains useful information such as the number of fields.
- Specified by:
factoryin interfaceDocumentSequence- Returns:
- the factory used by this sequence.
-
close
public void close() throws IOExceptionDescription copied from interface:DocumentSequenceCloses this document sequence, releasing all resources.You should always call this method after having finished with this document sequence. 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 interfaceDocumentSequence- Overrides:
closein classAbstractDocumentSequence- Throws:
IOException
-
main
public static void main(String[] arg) throws com.martiansoftware.jsap.JSAPException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, IOException, InstantiationException
- Throws:
com.martiansoftware.jsap.JSAPExceptionIllegalAccessExceptionInvocationTargetExceptionNoSuchMethodExceptionIOExceptionInstantiationException
-
-