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 StreamImpl

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

Direct Known Subclasses:
  ClassLoaderStream, FileReadStream, JniStream, LogStream, MemoryPath.MemoryStream, MemoryStream, MultipartStream, PipeStream, ReaderWriterStream, SocketStream, StderrStream, StdoutStream, StreamFilter, StringStream, StringWriter, TempReadStream, TempStream, TimestampFilter, VfsStream

public class StreamImpl
extends java.lang.Object

This is the service provider's interface for a stream supported by the VFS.

Field Summary
`protected static NullPath` | `nullPath`
`protected Path` | `path`

Constructor Summary
`StreamImpl()`

Method Summary
`boolean` | `canRead()` Returns true if this is a read stream.
`boolean` | `canWrite()` Returns true if this is a writable stream.
`void` | `clearWrite()` Clears any buffered values in the write.
`void` | `close()` Closes the stream.
`void` | `flush()` Flushes the write output.
`java.lang.Object` | `getAttribute(java.lang.String name)` Returns a stream attribute.
`java.util.Iterator` | `getAttributeNames()` Returns an iterator of the attribute names.
`int` | `getAvailable()` Returns the number of bytes available without blocking.
`boolean` | `getFlushOnNewline()` Returns true if the buffer should be flushed on every newline.
`byte[]` | `getNewline()` Returns the stream's natural newline character.
`Path` | `getPath()` Returns the Path associated with the stream.
`long` | `getReadPosition()` Returns the current read position of the underlying file.
`boolean` | `hasSkip()` Returns true if the stream implements skip.
`int` | `read(byte[] buffer, int offset, int length)` Reads the next chunk from the stream.
`void` | `removeAttribute(java.lang.String name)` Removes a stream attribute.
`void` | `setAttribute(java.lang.String name, java.lang.Object value)` Sets a stream attribute.
`void` | `setPath(Path path)` Sets the Path associated with the stream.
`long` | `skip(long n)` Skips a number of bytes, returning the bytes skipped.
`void` | `write(byte[] buffer, int offset, int length, boolean isEnd)` Writes a buffer to the underlying stream.

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

Field Detail

### nullPath

    protected static NullPath nullPath

### path

    protected Path path

Constructor Detail

### StreamImpl

    public StreamImpl()

Method Detail

### getNewline

    public byte[] getNewline()

  Returns the stream's natural newline character.

### hasSkip

    public boolean hasSkip()

  Returns true if the stream implements skip.

### skip

    public long skip(long n)
              throws java.io.IOException

  Skips a number of bytes, returning the bytes skipped.
  Parameters:
    `n` - the number of types to skip.
  Returns:
    the actual bytes skipped.

### canRead

    public boolean canRead()

  Returns true if this is a read stream.

### read

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

  Reads the next chunk from the stream.
  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

  Returns the number of bytes available without blocking. Depending on the stream, this may return less than the actual bytes, but will always return a number > 0 if there is any data available.

### getReadPosition

    public long getReadPosition()

  Returns the current read position of the underlying file.

### canWrite

    public boolean canWrite()

  Returns true if this is a writable stream.

### getFlushOnNewline

    public boolean getFlushOnNewline()

  Returns true if the buffer should be flushed on every newline. This is typically only true for error streams like stderr:.

### write

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

  Writes a buffer to the underlying stream.
  Parameters:
    `buffer` - the byte array to write.
    `offset` - the offset into the byte array.
    `length` - the number of bytes to write.
    `isEnd` - true when the write is flushing a close.

### clearWrite

    public void clearWrite()

  Clears any buffered values in the write.

### flush

    public void flush()
               throws java.io.IOException

  Flushes the write output.

### getPath

    public Path getPath()

  Returns the Path associated with the stream.

### setPath

    public void setPath(Path path)

  Sets the Path associated with the stream.

### getAttribute

    public java.lang.Object getAttribute(java.lang.String name)
                                  throws java.io.IOException

  Returns a stream attribute.
  Parameters:
    `name` - the attribute name.
  Returns:
    the attribute value.

### setAttribute

    public void setAttribute(java.lang.String name,
                             java.lang.Object value)
                      throws java.io.IOException

  Sets a stream attribute.
  Parameters:
    `name` - the attribute name.
    `value` - the attribute value.

### removeAttribute

    public void removeAttribute(java.lang.String name)
                         throws java.io.IOException

  Removes a stream attribute.
  Parameters:
    `name` - the attribute name.

### getAttributeNames

    public java.util.Iterator getAttributeNames()
                                         throws java.io.IOException

  Returns an iterator of the attribute names.

### close

    public void close()
               throws java.io.IOException

  Closes the stream.

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