IT. Expert System.

Android Reference

PipedWriter


java.io

Class PipedWriter

  • All Implemented Interfaces:
    Closeable, Flushable, Appendable, AutoCloseable


    public class PipedWriter
    extends Writer
    Places information on a communications pipe. When two threads want to pass data back and forth, one creates a piped writer and the other creates a piped reader.
    See Also:
    PipedReader
    • Constructor Detail

      • PipedWriter

        public PipedWriter()
        Constructs a new unconnected PipedWriter. The resulting writer must be connected to a PipedReader before data may be written to it.
        See Also:
        PipedReader
      • PipedWriter

        public PipedWriter(PipedReader destination)
                    throws IOException
        Constructs a new PipedWriter connected to destination. Any data written to this writer can be read from destination.
        Parameters:
        destination - the PipedReader to connect to.
        Throws:
        IOException - if destination is already connected.
    • Method Detail

      • close

        public void close()
                   throws IOException
        Closes this writer. If a 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.
        Specified by:
        close in interface Closeable
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in class Writer
        Throws:
        IOException - if an error occurs while closing this writer.
      • connect

        public void connect(PipedReader reader)
                     throws IOException
        Connects this PipedWriter to a PipedReader. Any data written to this writer becomes readable in the reader.
        Parameters:
        reader - the reader to connect to.
        Throws:
        IOException - if this writer is closed or already connected, or if reader is already connected.
      • flush

        public void flush()
                   throws IOException
        Notifies the readers of this PipedReader that characters can be read. This method does nothing if this Writer is not connected.
        Specified by:
        flush in interface Flushable
        Specified by:
        flush in class Writer
        Throws:
        IOException - if an I/O error occurs while flushing this writer.
      • write

        public void write(char[] buffer,
                 int offset,
                 int count)
                   throws IOException
        Writes count characters from the character array buffer starting at offset index to this writer. The written data can then be read from the connected PipedReader instance.

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

        Specified by:
        write in class Writer
        Parameters:
        buffer - the buffer to write.
        offset - the index of the first character in buffer to write.
        count - the number of characters from buffer to write to this writer.
        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 writer is closed or not connected, if the target reader is closed or if the thread reading from the target reader is no longer alive. This case is currently not handled correctly.
        NullPointerException - if buffer is null.
      • write

        public void write(int c)
                   throws IOException
        Writes a single character c to this writer. This character can then be read from the connected PipedReader instance.

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

        Overrides:
        write in class Writer
        Parameters:
        c - the character 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 writer is closed or not connected, if the target reader is closed or if the thread reading from the target reader 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: 534 / . Delta: 0.02188 с