示例#1
0
        /*
         * Closes this writer. If a {@link PipedReader} is connected to this writer,
         * it is closed as well and the pipe is disconnected. Any data buffered in
         * the reader can still be read.
         *
         * @throws IOException
         *             if an error occurs while closing this writer.
         */

        public override void close()// throws IOException {
        {
            lock (lockJ) {
                /* Is the pipe connected? */
                if (dest != null)
                {
                    dest.done();
                    dest = null;
                }
                closed = true;
            }
        }
示例#2
0
 /*
  * Connects this {@code PipedWriter} to a {@link PipedReader}. Any data
  * written to this writer becomes readable in the reader.
  *
  * @param stream
  *            the reader to connect to.
  * @throws IOException
  *             if this writer is closed or already connected, or if {@code
  *             stream} is already connected.
  */
 public void connect(PipedReader stream)//throws IOException {
 {
     lock (lockJ) {
         if (this.dest != null)
         {
             throw new IOException("Already connected");                     //$NON-NLS-1$
         }
         if (closed)
         {
             throw new IOException("Pipe is closed");                     //$NON-NLS-1$
         }
         stream.establishConnection();
         this.dest = stream;
     }
 }
示例#3
0
 /**
  * Closes this writer. If a {@link PipedReader} is connected to this writer,
  * it is closed as well and the pipe is disconnected. Any data buffered in
  * the reader can still be read.
  *
  * @throws IOException
  *             if an error occurs while closing this writer.
  */
 public override void close()
 {
     // throws IOException {
     lock (lockJ) {
     /* Is the pipe connected? */
     if (dest != null) {
         dest.done();
         dest = null;
     }
     closed = true;
     }
 }
示例#4
0
 //throws IOException {
 /**
  * Constructs a new {@code PipedWriter} connected to the {@link PipedReader}
  * {@code dest}. Any data written to this writer can be read from {@code
  * dest}.
  *
  * @param dest
  *            the {@code PipedReader} to connect to.
  * @throws IOException
  *             if {@code dest} is already connected.
  */
 public PipedWriter(PipedReader dest)
     : base(dest)
 {
     connect(dest);
 }
示例#5
0
 /**
  * Connects this {@code PipedWriter} to a {@link PipedReader}. Any data
  * written to this writer becomes readable in the reader.
  *
  * @param stream
  *            the reader to connect to.
  * @throws IOException
  *             if this writer is closed or already connected, or if {@code
  *             stream} is already connected.
  */
 public void connect(PipedReader stream)
 {
     //throws IOException {
     lock (lockJ) {
     if (this.dest != null) {
             throw new IOException("Already connected"); //$NON-NLS-1$
     }
     if (closed) {
             throw new IOException("Pipe is closed"); //$NON-NLS-1$
     }
     stream.establishConnection();
     this.dest = stream;
     }
 }
示例#6
0
 /*
  * Constructs a new {@code PipedWriter} connected to the {@link PipedReader}
  * {@code dest}. Any data written to this writer can be read from {@code
  * dest}.
  *
  * @param dest
  *            the {@code PipedReader} to connect to.
  * @throws IOException
  *             if {@code dest} is already connected.
  */
 public PipedWriter(PipedReader dest) ://throws IOException {
     base(dest)
 {
     connect(dest);
 }