IndexInput (Lucene 2.4.1 API)
Keywords: org.apache.lucene.store.IndexInput class

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 IndexInput

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

All Implemented Interfaces:
  Cloneable

Direct Known Subclasses:
  BufferedIndexInput, ChecksumIndexInput

    public abstract class IndexInput

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`

Constructor Summary
`IndexInput()`

Method Summary
`Object` | `clone()` Returns a clone of this stream.
`abstract void` | `close()` Closes the stream to futher operations.
`abstract long` | `getFilePointer()` Returns the current position in this file, where the next read will occur.
`abstract long` | `length()` The number of bytes in the file.
`abstract byte` | `readByte()` Reads and returns a single byte.
`abstract void` | `readBytes(byte[] b, int offset, int len)` Reads a specified number of bytes into an array at the specified offset.
`void` | `readBytes(byte[] b, int offset, int len, boolean useBuffer)` Reads a specified number of bytes into an array at the specified offset with control over whether the read should be buffered (callers who have their own buffer should pass in "false" for useBuffer).
`void` | `readChars(char[] buffer, int start, int length)` Deprecated. -- please use readString or readBytes instead, and construct the string from those utf8 bytes
`int` | `readInt()` Reads four bytes and returns an int.
`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.
`abstract void` | `seek(long pos)` Sets current position in this file, where the next read will occur.
`void` | `setModifiedUTF8StringsMode()` Call this if readString should read characters stored in the old modified UTF8 format (length in java chars and java's modified UTF8 encoding).
`void` | `skipChars(int length)` Deprecated. this method operates on old "modified utf8" encoded strings

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

Constructor Detail

### IndexInput

    public IndexInput()

Method Detail

### readByte

    public abstract byte readByte()
                           throws IOException

  Reads and returns a single byte.

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

### readBytes

    public abstract 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:
    `IndexOutput.writeBytes(byte[],int)`

### readBytes

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

  Reads a specified number of bytes into an array at the specified offset with control over whether the read should be buffered (callers who have their own buffer should pass in "false" for useBuffer). Currently only `BufferedIndexInput` respects this parameter.

  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
    `useBuffer` - set to false if the caller will handle buffering.
  Throws:
    `IOException`
  See Also:
    `IndexOutput.writeBytes(byte[],int)`

### readInt

    public int readInt()
                throws IOException

  Reads four bytes and returns an int.

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

### readVInt

    public 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:
    `IndexOutput.writeVInt(int)`

### readLong

    public long readLong()
                  throws IOException

  Reads eight bytes and returns a long.

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

### readVLong

    public 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`

### setModifiedUTF8StringsMode

    public void setModifiedUTF8StringsMode()

  Call this if readString should read characters stored in the old modified UTF8 format (length in java chars and java's modified UTF8 encoding). This is used for indices written pre-2.4 See LUCENE-510 for details.

### readString

    public String readString()
                      throws IOException

  Reads a string.

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

### readChars

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

  Deprecated. -- please use readString or readBytes instead, and construct the string from those utf8 bytes

  Reads Lucene's old "modified 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:
    `IndexOutput.writeChars(String,int,int)`

### skipChars

    public void skipChars(int length)
                   throws IOException

  Deprecated. this method operates on old "modified utf8" encoded strings

  Expert Similar to `readChars(char[], int, int)` but does not do any conversion operations on the bytes it is reading in. It still has to invoke `readByte()` just as `readChars(char[], int, int)` does, but it does not need a buffer to store anything and it does not have to do any of the bitwise operations, since we don't actually care what is in the byte except to determine how many more bytes to read

  Parameters:
    `length` - The number of chars to read
  Throws:
    `IOException`

### close

    public abstract void close()
                        throws IOException

  Closes the stream to futher operations.

  Throws:
    `IOException`

### getFilePointer

    public abstract long getFilePointer()

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

  See Also:
    `seek(long)`

### seek

    public abstract void seek(long pos)
                       throws IOException

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

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

### length

    public abstract 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.

  Overrides:
    `clone` in class `Object`

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-2009 Apache Software Foundation. All Rights Reserved.