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

## ij.io
Class RandomAccessStream

    java.lang.Object
      java.io.InputStream
          ij.io.RandomAccessStream

public final class RandomAccessStream
extends java.io.InputStream

This is a class that uses a memory cache to allow seeking within an InputStream. Based on the JAI MemoryCacheSeekableStream class. Can also be constructed from a RandomAccessFile, which uses less memory since the memory cache is not required.

Constructor Summary
`RandomAccessStream(java.io.InputStream inputstream)` Constructs a RandomAccessStream from an InputStream.
`RandomAccessStream(java.io.RandomAccessFile ras)` Constructs a RandomAccessStream from an RandomAccessFile.

Method Summary
`void` | `close()`
`int` | `getFilePointer()`
`int` | `read()`
`int` | `read(byte[] bytes, int off, int len)`
`double` | `readDouble()`
`float` | `readFloat()`
`void` | `readFully(byte[] bytes)`
`void` | `readFully(byte[] bytes, int len)`
`int` | `readInt()`
`long` | `readLong()`
`short` | `readShort()`
`void` | `seek(int loc)`

Methods inherited from class java.io.InputStream
`available, mark, markSupported, read, reset, skip`

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

Constructor Detail

### RandomAccessStream

    public RandomAccessStream(java.io.InputStream inputstream)

  Constructs a RandomAccessStream from an InputStream. Seeking backwards is supported using a memory cache.

### RandomAccessStream

    public RandomAccessStream(java.io.RandomAccessFile ras)

  Constructs a RandomAccessStream from an RandomAccessFile.

Method Detail

### getFilePointer

    public int getFilePointer()
                       throws java.io.IOException

  Throws:
    `java.io.IOException`

### read

    public int read()
             throws java.io.IOException

  Throws:
    `java.io.IOException`

### read

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

  Throws:
    `java.io.IOException`

### readFully

    public final void readFully(byte[] bytes)
                         throws java.io.IOException

  Throws:
    `java.io.IOException`

### readFully

    public final void readFully(byte[] bytes,
                                int len)
                         throws java.io.IOException

  Throws:
    `java.io.IOException`

### seek

    public void seek(int loc)
              throws java.io.IOException

  Throws:
    `java.io.IOException`

### readInt

    public final int readInt()
                      throws java.io.IOException

  Throws:
    `java.io.IOException`

### readLong

    public final long readLong()
                        throws java.io.IOException

  Throws:
    `java.io.IOException`

### readDouble

    public final double readDouble()
                            throws java.io.IOException

  Throws:
    `java.io.IOException`

### readShort

    public final short readShort()
                          throws java.io.IOException

  Throws:
    `java.io.IOException`

### readFloat

    public final float readFloat()
                          throws java.io.IOException

  Throws:
    `java.io.IOException`

### close

    public void close()
               throws java.io.IOException

  Throws:
    `java.io.IOException`

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