Alien-SVN

 view release on metacpan or  search on metacpan

src/subversion/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNInputStream.java  view on Meta::CPAN


    /**
     * Get the Interface to connect to SVNAdmin
     * @return the connection interface
     */
    public OutputInterface getOutputer()
    {
        return myOutputer;
    }

    /**
     * Closes this input stream and releases any system resources associated
     * with the stream.
     *
     * <p> The <code>close</code> method of <code>InputStream</code> does
     * nothing.
     *
     * @throws  IOException  if an I/O error occurs.
     */
    public void close() throws IOException
    {
        myOutputer.closed = true;
        super.close();
    }

    /**
     * this class implements the connection to SVNAdmin
     */
    public class Outputer implements OutputInterface
    {
        /**
         * my side of the pipe
         */
        PipedOutputStream myStream;

        /**
         * flag that the other side of the pipe has been closed
         */
        boolean closed;

        /**
         * build a new connection object
         * @param myMaster  the other side of the pipe
         * @throws IOException
         */
        Outputer(SVNInputStream myMaster) throws IOException
        {
            myStream =new PipedOutputStream(myMaster);
        }

        /**
         * write the bytes in data to java
         * @param data          the data to be written
         * @throws IOException  throw in case of problems.
         */
        public int write(byte[] data) throws IOException
        {
            if (closed)
                throw new IOException("stream has been closed");
            myStream.write(data);
            return data.length;
        }

        /**
         * close the output
         * @throws IOException throw in case of problems.
         */
        public void close() throws IOException
        {
            myStream.close();
        }
    }
}



( run in 1.371 second using v1.01-cache-2.11-cpan-99c4e6809bf )