001/*
002 * Copyright (c) 2006-2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 *
009 * Contributors:
010 *     Nuxeo - initial API and implementation
011 *
012 * $Id: DocumentReader.java 29029 2008-01-14 18:38:14Z ldoguin $
013 */
014
015package org.nuxeo.ecm.core.io;
016
017import java.io.IOException;
018
019/**
020 * A document reader. This reader is designed to be accessed remotely (over a network).
021 *
022 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
023 */
024public interface DocumentReader {
025
026    /**
027     * Reads a single document.
028     *
029     * @return the document read or null if there are no more documents to read
030     * @throws IOException
031     */
032    ExportedDocument read() throws IOException;
033
034    /**
035     * Reads next 'count' documents.
036     *
037     * @param count the number of documents to read
038     * @return the array of read documents or null if there are no more documents to read
039     * @throws IOException
040     */
041    ExportedDocument[] read(int count) throws IOException;
042
043    /**
044     * Closes the reader.
045     */
046    void close();
047
048}