📄 documentsequence.java
字号:
package it.unimi.dsi.mg4j.document;/* * MG4J: Managing Gigabytes for Java * * Copyright (C) 2005-2007 Paolo Boldi and Sebastiano Vigna * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */import java.io.Closeable;import java.io.IOException;/** A sequence of documents. * * <p>This is the most basic class available in MG4J for representing * a sequence to documents to be indexed. Its only duty is to be able to * return once an iterator over the documents in sequence. * * <p>The iterator returned by {@link #iterator()} must always return the * same documents in the same order, given the same external conditions * (standard input, file system, etc.). * * <p>Document sequences must always return documents of the same type. This * is usually accomplished by providing at construction time a {@link DocumentFactory} * that will be used to build and parse documents. Of course, it is possible to * create document sequences with a hardwired factory (see, e.g., {@link it.unimi.dsi.mg4j.document.ZipDocumentCollection}). */public interface DocumentSequence extends Closeable { /** Returns an iterator over the sequence of documents. * * <p><strong>Warning</strong>: this method can be safely called * just <em>one</em> time. For instance, implementations based * on standard input will usually throw an exception if this * method is called twice. * * <p>Implementations may decide to override this restriction * (in particular, if they implement {@link DocumentCollection}). Usually, * however, it is not possible to obtain <em>two</em> iterators at the * same time on a collection. * * @return an iterator over the sequence of documents. * @see DocumentCollection */ public DocumentIterator iterator() throws IOException; /** Returns the factory used by this sequence. * * <P>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. * * @return the factory used by this sequence. */ public DocumentFactory factory(); /** Closes this document sequence, releasing all resources. * * <p>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 {@link it.unimi.dsi.io.SafelyCloseable}), but since there * is no guarantee as to when finalisers are invoked, you should not depend on this behaviour. */ public void close() throws IOException;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -