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

## org.apache.lucene.store
Class InputStream

    java.lang.Object
      org.apache.lucene.store.InputStream

All Implemented Interfaces:
  Cloneable

public abstract class InputStream
extends Object
implements Cloneable

Abstract base class for input from a file in a `Directory`. A random-access input stream. Used for all Lucene index input operations.

See Also:
  `Directory`, `OutputStream`

Field Summary
`protected long` | `length`

Constructor Summary
`InputStream()`

Method Summary
`Object` | `clone()` Returns a clone of this stream.
`abstract void` | `close()` Closes the stream to futher operations.
`long` | `getFilePointer()` Returns the current position in this file, where the next read will occur.
`long` | `length()` The number of bytes in the file.
`byte` | `readByte()` Reads and returns a single byte.
`void` | `readBytes(byte[] b, int offset, int len)` Reads a specified number of bytes into an array at the specified offset.
`void` | `readChars(char[] buffer, int start, int length)` Reads UTF-8 encoded characters into an array.
`int` | `readInt()` Reads four bytes and returns an int.
`protected abstract void` | `readInternal(byte[] b, int offset, int length)` Expert: implements buffer refill.
`long` | `readLong()` Reads eight bytes and returns a long.
`String` | `readString()` Reads a string.
`int` | `readVInt()` Reads an int stored in variable-length format.
`long` | `readVLong()` Reads a long stored in variable-length format.
`void` | `seek(long pos)` Sets current position in this file, where the next read will occur.
`protected abstract void` | `seekInternal(long pos)` Expert: implements seek.

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

Field Detail

### length

    protected long length

Constructor Detail

### InputStream

    public InputStream()

Method Detail

### readByte

    public final byte readByte()
                        throws IOException

  Reads and returns a single byte.

  Throws:
    `IOException`
  See Also:
    `OutputStream.writeByte(byte)`

### readBytes

    public final void readBytes(byte[] b,
                                int offset,
                                int len)
                         throws IOException

  Reads a specified number of bytes into an array at the specified offset.

  Parameters:
    `b` - the array to read bytes into
    `offset` - the offset in the array to start storing bytes
    `len` - the number of bytes to read
  Throws:
    `IOException`
  See Also:
    `OutputStream.writeBytes(byte[],int)`

### readInt

    public final int readInt()
                      throws IOException

  Reads four bytes and returns an int.

  Throws:
    `IOException`
  See Also:
    `OutputStream.writeInt(int)`

### readVInt

    public final int readVInt()
                       throws IOException

  Reads an int stored in variable-length format. Reads between one and five bytes. Smaller values take fewer bytes. Negative numbers are not supported.

  Throws:
    `IOException`
  See Also:
    `OutputStream.writeVInt(int)`

### readLong

    public final long readLong()
                        throws IOException

  Reads eight bytes and returns a long.

  Throws:
    `IOException`
  See Also:
    `OutputStream.writeLong(long)`

### readVLong

    public final long readVLong()
                         throws IOException

  Reads a long stored in variable-length format. Reads between one and nine bytes. Smaller values take fewer bytes. Negative numbers are not supported.

  Throws:
    `IOException`

### readString

    public final String readString()
                            throws IOException

  Reads a string.

  Throws:
    `IOException`
  See Also:
    `OutputStream.writeString(String)`

### readChars

    public final void readChars(char[] buffer,
                                int start,
                                int length)
                         throws IOException

  Reads UTF-8 encoded characters into an array.

  Parameters:
    `buffer` - the array to read characters into
    `start` - the offset in the array to start storing characters
    `length` - the number of characters to read
  Throws:
    `IOException`
  See Also:
    `OutputStream.writeChars(String,int,int)`

### readInternal

    protected abstract void readInternal(byte[] b,
                                         int offset,
                                         int length)
                                  throws IOException

  Expert: implements buffer refill. Reads bytes from the current position in the input.

  Parameters:
    `b` - the array to read bytes into
    `offset` - the offset in the array to start storing bytes
    `length` - the number of bytes to read
  Throws:
    `IOException`

### close

    public abstract void close()
                        throws IOException

  Closes the stream to futher operations.

  Throws:
    `IOException`

### getFilePointer

    public final long getFilePointer()

  Returns the current position in this file, where the next read will occur.

  See Also:
    `seek(long)`

### seek

    public final void seek(long pos)
                    throws IOException

  Sets current position in this file, where the next read will occur.

  Throws:
    `IOException`
  See Also:
    `getFilePointer()`

### seekInternal

    protected abstract void seekInternal(long pos)
                                  throws IOException

  Expert: implements seek. Sets current position in this file, where the next `readInternal(byte[],int,int)` will occur.

  Throws:
    `IOException`
  See Also:
    `readInternal(byte[],int,int)`

### length

    public final long length()

  The number of bytes in the file.

### clone

    public Object clone()

  Returns a clone of this stream.

  Clones of a stream access the same data, and are positioned at the same point as the stream they were cloned from.

  Expert: Subclasses must ensure that clones may be positioned at different points in the input from each other and from the stream they were cloned from.

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

Copyright © 2000-2005 Apache Software Foundation. All Rights Reserved.