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

## com.sun.jimi.util
Class FullyBufferedInputStream

    java.lang.Object
      |
      +--java.io.InputStream
            |
            +--java.io.FilterInputStream
                  |
                  +--com.sun.jimi.util.FullyBufferedInputStream

public class FullyBufferedInputStream
extends java.io.FilterInputStream

This class implements a buffered input stream which sits on top of any existing InputStream. This class buffers all data read through the underlying stream and therefore provides a markable input stream for any underlying stream. At initialisation a mark() is made at the start of the input stream to enable return to start of stream using reset(); [eventually] The currently used portion of the buffer can be dropped if required via dropBuf(). This class could be extended to keep the buffered input data stream in a local file cache in the future. This would involved checking for write capabilities and the definition [probably in environment] for where to write the files too. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Field Summary
`protected java.util.Vector` | `buffers` maintains the sequential set of allocated memory buffers which in total hold all the buffered data.
`protected int` | `bufSize` size of each allocated buffer stored in buffers
`protected static int` | `BUFSIZE` default size of chunks of input stream to store and read in at a time.
`protected int` | `count` index of next location in buffer that is free to use
`protected java.io.InputStream` | `in` The underlying input stream.
`protected int` | `markpos` Marked location in input stream.
`protected int` | `pos` index of next character to deliver

Fields inherited from class java.io.FilterInputStream
`in`

Constructor Summary
`FullyBufferedInputStream(java.io.InputStream in)` Constructor
`FullyBufferedInputStream(java.io.InputStream in, int bufSize)` Allows control of the bufSize for buffering

Method Summary
`int` | `available()`
`void` | `close()`
`void` | `dropBuf()` Release all buffered data and memory.
`void` | `mark(int readlimit)` Mark a location in the input stream, note that the readlimit is totally ingored.
`boolean` | `markSupported()` Marks are always supported by this input stream.
`int` | `read()`
`int` | `read(byte[] b, int off, int len)`
`void` | `reset()` Reset position to the mark.
`long` | `skip(long n)`

Methods inherited from class java.io.FilterInputStream
`read`

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

Field Detail

### in

    protected java.io.InputStream in

  The underlying input stream.

### buffers

    protected java.util.Vector buffers

  maintains the sequential set of allocated memory buffers which in total hold all the buffered data.

### count

    protected int count

  index of next location in buffer that is free to use

### pos

    protected int pos

  index of next character to deliver

### bufSize

    protected int bufSize

  size of each allocated buffer stored in buffers

### markpos

    protected int markpos

  Marked location in input stream. This is -1 if not set or if its been invalidated If set will always be to a location within the available data. ie markpos <= count. It is possible to mark location 0 when no data buffered and it is possible to have a mark at the very end of the data stream.

### BUFSIZE

    protected static final int BUFSIZE

  default size of chunks of input stream to store and read in at a time.

Constructor Detail

### FullyBufferedInputStream

    public FullyBufferedInputStream(java.io.InputStream in)

  Constructor

### FullyBufferedInputStream

    public FullyBufferedInputStream(java.io.InputStream in,
                                    int bufSize)

  Allows control of the bufSize for buffering

Method Detail

### dropBuf

    public void dropBuf()

  Release all buffered data and memory. This is equivalent to intialising the buffer system - Rob fiX - this is stuffed - what if i call this when i havnt - passed all the data to client yet... should only - clear data that has allready been sent to client. - move up unsent dat to begining of buffer area then - nuke the rest.

### read

    public int read()
             throws java.io.IOException

  Overrides:
    read in class java.io.FilterInputStream

### read

    public int read(byte[] b,
                    int off,
                    int len)
             throws java.io.IOException

  Overrides:
    read in class java.io.FilterInputStream

### skip

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

  Overrides:
    skip in class java.io.FilterInputStream

### close

    public void close()
               throws java.io.IOException

  Overrides:
    close in class java.io.FilterInputStream

### available

    public int available()
                  throws java.io.IOException

  Overrides:
    available in class java.io.FilterInputStream

### mark

    public void mark(int readlimit)

  Mark a location in the input stream, note that the readlimit is totally ingored. Any call to this will override any previous mark.
  Overrides:
    mark in class java.io.FilterInputStream

### reset

    public void reset()
               throws java.io.IOException

  Reset position to the mark. This does not invalidate the mark.
  Overrides:
    reset in class java.io.FilterInputStream

### markSupported

    public boolean markSupported()

  Marks are always supported by this input stream.
  Overrides:
    markSupported in class java.io.FilterInputStream

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