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 MockIndexInputWrapper

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

All Implemented Interfaces:
  Closeable, Cloneable

    public class MockIndexInputWrapper

extends IndexInput

Used by MockDirectoryWrapper to create an input stream that keeps track of when it's been closed.

Constructor Summary
`MockIndexInputWrapper(MockDirectoryWrapper dir, String name, IndexInput delegate)` Construct an empty output buffer.

Method Summary
`Object` | `clone()` Returns a clone of this stream.
`void` | `close()` Closes the stream to further operations.
`void` | `copyBytes(IndexOutput out, long numBytes)` Copies `numBytes` bytes to the given `IndexOutput`.
`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` | `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)` Reads Lucene's old "modified UTF-8" encoded characters into an array.
`int` | `readInt()` Reads four bytes and returns an int.
`long` | `readLong()` Reads eight bytes and returns a long.
`String` | `readString()` Reads a string.
`Map<String,String>` | `readStringStringMap()`
`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.
`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)` Expert Similar to `DataInput.readChars(char[], int, int)` but does not do any conversion operations on the bytes it is reading in.

Methods inherited from class org.apache.lucene.store.IndexInput
`toString`

Methods inherited from class org.apache.lucene.store.DataInput
`readShort`

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

Constructor Detail

### MockIndexInputWrapper

    public MockIndexInputWrapper(MockDirectoryWrapper dir,
                                 String name,
                                 IndexInput delegate)

  Construct an empty output buffer.

Method Detail

### close

    public void close()
               throws IOException

  Description copied from class: `IndexInput`
  Closes the stream to further operations.

  Specified by:
    `close` in interface `Closeable`
  Specified by:
    `close` in class `IndexInput`
  Throws:
    `IOException`

### clone

    public Object clone()

  Description copied from class: `DataInput`
  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 `DataInput`

### getFilePointer

    public long getFilePointer()

  Description copied from class: `IndexInput`
  Returns the current position in this file, where the next read will occur.

  Specified by:
    `getFilePointer` in class `IndexInput`
  See Also:
    `IndexInput.seek(long)`

### seek

    public void seek(long pos)
              throws IOException

  Description copied from class: `IndexInput`
  Sets current position in this file, where the next read will occur.

  Specified by:
    `seek` in class `IndexInput`
  Throws:
    `IOException`
  See Also:
    `IndexInput.getFilePointer()`

### length

    public long length()

  Description copied from class: `IndexInput`
  The number of bytes in the file.

  Specified by:
    `length` in class `IndexInput`

### readByte

    public byte readByte()
                  throws IOException

  Description copied from class: `DataInput`
  Reads and returns a single byte.

  Specified by:
    `readByte` in class `DataInput`
  Throws:
    `IOException`
  See Also:
    `DataOutput.writeByte(byte)`

### readBytes

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

  Description copied from class: `DataInput`
  Reads a specified number of bytes into an array at the specified offset.

  Specified by:
    `readBytes` in class `DataInput`
  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:
    `DataOutput.writeBytes(byte[],int)`

### copyBytes

    public void copyBytes(IndexOutput out,
                          long numBytes)
                   throws IOException

  Description copied from class: `IndexInput`
  Copies `numBytes` bytes to the given `IndexOutput`.

  NOTE: this method uses an intermediate buffer to copy the bytes. Consider overriding it in your implementation, if you can make a better, optimized copy.

  NOTE ensure that there are enough bytes in the input to copy to output. Otherwise, different exceptions may be thrown, depending on the implementation.

  Overrides:
    `copyBytes` in class `IndexInput`
  Throws:
    `IOException`

### readBytes

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

  Description copied from class: `DataInput`
  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.

  Overrides:
    `readBytes` in class `DataInput`
  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:
    `DataOutput.writeBytes(byte[],int)`

### readInt

    public int readInt()
                throws IOException

  Description copied from class: `DataInput`
  Reads four bytes and returns an int.

  Overrides:
    `readInt` in class `DataInput`
  Throws:
    `IOException`
  See Also:
    `DataOutput.writeInt(int)`

### readVInt

    public int readVInt()
                 throws IOException

  Description copied from class: `DataInput`
  Reads an int stored in variable-length format. Reads between one and five bytes. Smaller values take fewer bytes. Negative numbers are not supported.

  Overrides:
    `readVInt` in class `DataInput`
  Throws:
    `IOException`
  See Also:
    `DataOutput.writeVInt(int)`

### readLong

    public long readLong()
                  throws IOException

  Description copied from class: `DataInput`
  Reads eight bytes and returns a long.

  Overrides:
    `readLong` in class `DataInput`
  Throws:
    `IOException`
  See Also:
    `DataOutput.writeLong(long)`

### readVLong

    public long readVLong()
                   throws IOException

  Description copied from class: `DataInput`
  Reads a long stored in variable-length format. Reads between one and nine bytes. Smaller values take fewer bytes. Negative numbers are not supported.

  Overrides:
    `readVLong` in class `DataInput`
  Throws:
    `IOException`

### readString

    public String readString()
                      throws IOException

  Description copied from class: `DataInput`
  Reads a string.

  Overrides:
    `readString` in class `DataInput`
  Throws:
    `IOException`
  See Also:
    `DataOutput.writeString(String)`

### readStringStringMap

    public Map<String,String> readStringStringMap()
                                           throws IOException

  Overrides:
    `readStringStringMap` in class `DataInput`
  Throws:
    `IOException`

### setModifiedUTF8StringsMode

    public void setModifiedUTF8StringsMode()

  Description copied from class: `DataInput`
  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.

  Overrides:
    `setModifiedUTF8StringsMode` in class `DataInput`

### readChars

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

  Description copied from class: `DataInput`
  Reads Lucene's old "modified UTF-8" encoded characters into an array.

  Overrides:
    `readChars` in class `DataInput`
  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:
    `DataOutput.writeChars(String,int,int)`

### skipChars

    public void skipChars(int length)
                   throws IOException

  Description copied from class: `IndexInput`
  Expert Similar to `DataInput.readChars(char[], int, int)` but does not do any conversion operations on the bytes it is reading in. It still has to invoke `DataInput.readByte()` just as `DataInput.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

  Overrides:
    `skipChars` in class `IndexInput`
  Parameters:
    `length` - The number of chars to read
  Throws:
    `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