All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ow2.util.stream.api.IStreamAccessor Maven / Gradle / Ivy

There is a newer version: 1.0.37
Show newest version
/**
 * OW2 Util
 * Copyright (C) 2008 Bull S.A.S.
 * Contact: [email protected]
 *
 * 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 *
 * --------------------------------------------------------------------------
 * $Id: IStreamAccessor.java 4483 2009-01-26 08:47:13Z gaellalire $
 * --------------------------------------------------------------------------
 */

package org.ow2.util.stream.api;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

/**
 * Data writted in {@link OutputStream} can be read with the {@link InputStream}.
 * @author Gael Lalire
 */
public interface IStreamAccessor {

    /**
     * @return an input stream
     * @throws IOException if error occurs
     */
    InputStream getInputStream() throws IOException;

    /**
     * If you call this method the previous stream will be erased.
     * @return an output stream
     * @throws IOException if error occurs
     */
    OutputStream getOutputStream() throws IOException;

    /**
     * The file replace older only when output stream is closed.
     * Temporary means that input stream return same data while
     * we are writing to output stream. Some implementation may
     * provides this capability with no temporary outputstream
     * @return an output stream
     * @throws IOException if error occurs
     */
    OutputStream getTemporaryOutputStream() throws IOException;

    /**
     * After calling this method the inputStream will throw
     * an {@link IOException}.
     */
    void delete();

    /**
     * @return true if the stream can be read
     */
    boolean exists();

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy