Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.caucho.vfs
Class PipeStream

    java.lang.Object
      |
      +--com.caucho.vfs.StreamImpl
            |
            +--com.caucho.vfs.PipeStream

public class PipeStream
extends StreamImpl

Stream allowing two threads to read and write to each other.

Fields inherited from class com.caucho.vfs.StreamImpl
`nullPath, path`

Method Summary
`boolean` | `canRead()` PipeStreams can read
`boolean` | `canWrite()` The pipe stream can write.
`void` | `close()` Closes the stream.
`static java.lang.Object[]` | `create()` Creates a pipe pair.
`int` | `getAvailable()` Return the available bytes.
`int` | `read(byte[] buf, int offset, int length)` Reads the available bytes if any, otherwise block.
`void` | `write(byte[] buf, int offset, int length, boolean isEnd)` Implementation of the pipe write.

Methods inherited from class com.caucho.vfs.StreamImpl
`clearWrite, flush, getAttribute, getAttributeNames, getFlushOnNewline, getNewline, getPath, getReadPosition, hasSkip, removeAttribute, setAttribute, setPath, skip`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### create

    public static java.lang.Object[] create()

  Creates a pipe pair. The first object is a ReadStream, the second is a WriteStream.

### canRead

    public boolean canRead()

  PipeStreams can read
  Overrides:
    `canRead` in class `StreamImpl`

### read

    public int read(byte[] buf,
                    int offset,
                    int length)
             throws java.io.IOException

  Reads the available bytes if any, otherwise block.
  Overrides:
    `read` in class `StreamImpl`
  Following copied from class: `com.caucho.vfs.StreamImpl`
  Parameters:
    `buffer` - byte array receiving the data.
    `offset` - starting offset into the array.
    `length` - number of bytes to read.
  Returns:
    the number of bytes read or -1 on end of file.

### getAvailable

    public int getAvailable()
                     throws java.io.IOException

  Return the available bytes.
  Overrides:
    `getAvailable` in class `StreamImpl`

### canWrite

    public boolean canWrite()

  The pipe stream can write.
  Overrides:
    `canWrite` in class `StreamImpl`

### write

    public void write(byte[] buf,
                      int offset,
                      int length,
                      boolean isEnd)
               throws java.io.IOException

  Implementation of the pipe write.
  Overrides:
    `write` in class `StreamImpl`
  Parameters:
    `buf` - byte buffer containing the bytes
    `offset` - offset where to start writing
    `length` - number of bytes to write
    `isEnd` - true when the write is flushing a close.

### close

    public void close()
               throws java.io.IOException

  Description copied from class: `StreamImpl`
  Closes the stream.
  Overrides:
    `close` in class `StreamImpl`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD