IT. Expert System.

Android Reference

PipedOutputStream


java.io

Class PipedOutputStream

  • All Implemented Interfaces:
    Closeable, Flushable, AutoCloseable


    public class PipedOutputStream
    extends OutputStream
    Places information on a communications pipe. When two threads want to pass data back and forth, one creates a piped output stream and the other one creates a piped input stream.
    See Also:
    PipedInputStream
    • Constructor Detail

      • PipedOutputStream

        public PipedOutputStream()
        Constructs a new unconnected PipedOutputStream. The resulting stream must be connected to a PipedInputStream before data can be written to it.
      • PipedOutputStream

        public PipedOutputStream(PipedInputStream target)
                          throws IOException
        Constructs a new PipedOutputStream connected to the PipedInputStream target. Any data written to this stream can be read from the target stream.
        Parameters:
        target - the piped input stream to connect to.
        Throws:
        IOException - if this stream or target are already connected.
    • Method Detail

      • close

        public void close()
                   throws IOException
        Closes this stream. If this stream is connected to an input stream, the input stream is closed and the pipe is disconnected.
        Specified by:
        close in interface Closeable
        Specified by:
        close in interface AutoCloseable
        Overrides:
        close in class OutputStream
        Throws:
        IOException - if an error occurs while closing this stream.
      • connect

        public void connect(PipedInputStream stream)
                     throws IOException
        Connects this stream to a PipedInputStream. Any data written to this output stream becomes readable in the input stream.
        Parameters:
        stream - the piped input stream to connect to.
        Throws:
        IOException - if either stream is already connected.
      • write

        public void write(byte[] buffer,
                 int offset,
                 int count)
                   throws IOException
        Writes count bytes from the byte array buffer starting at offset to this stream. The written data can then be read from the connected input stream.

        Separate threads should be used to write to a PipedOutputStream and to read from the connected PipedInputStream. If the same thread is used, a deadlock may occur.

        Overrides:
        write in class OutputStream
        Parameters:
        buffer - the buffer to write.
        offset - the index of the first byte in buffer to write.
        count - the number of bytes from buffer to write to this stream.
        Throws:
        IndexOutOfBoundsException - if offset < 0 or count < 0, or if offset + count is bigger than the length of buffer.
        InterruptedIOException - if the pipe is full and the current thread is interrupted waiting for space to write data. This case is not currently handled correctly.
        IOException - if this stream is not connected, if the target stream is closed or if the thread reading from the target stream is no longer alive. This case is currently not handled correctly.
      • write

        public void write(int oneByte)
                   throws IOException
        Writes a single byte to this stream. Only the least significant byte of the integer oneByte is written. The written byte can then be read from the connected input stream.

        Separate threads should be used to write to a PipedOutputStream and to read from the connected PipedInputStream. If the same thread is used, a deadlock may occur.

        Specified by:
        write in class OutputStream
        Parameters:
        oneByte - the byte to write.
        Throws:
        InterruptedIOException - if the pipe is full and the current thread is interrupted waiting for space to write data. This case is not currently handled correctly.
        IOException - if this stream is not connected, if the target stream is closed or if the thread reading from the target stream is no longer alive. This case is currently not handled correctly.


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 10889 / . Delta: 0.24845 с