Lucene++ - a full-featured, c++ search engine
API Documentation

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Attributes
Lucene::IndexInput Class Referenceabstract

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

`#include <IndexInput.h>`

Inheritance diagram for Lucene::IndexInput:

## Public Member Functions

| IndexInput ()
virtual | ~IndexInput ()
virtual String | getClassName ()
boost::shared_ptr< IndexInput > | shared_from_this ()
virtual uint8_t | readByte ()=0
| Reads and returns a single byte.
virtual void | readBytes (uint8_t *b, int32_t offset, int32_t length)=0
| Reads a specified number of bytes into an array at the specified offset.
virtual void | readBytes (uint8_t *b, int32_t offset, int32_t length, bool 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). Currently only `BufferedIndexInput` respects this parameter.
virtual int32_t | readInt ()
| Reads four bytes and returns an int.
virtual int32_t | readVInt ()
| Reads an int stored in variable-length format. Reads between one and five bytes. Smaller values take fewer bytes. Negative numbers are not supported.
virtual int64_t | readLong ()
| Reads eight bytes and returns a int64.
virtual int64_t | readVLong ()
| Reads a int64 stored in variable-length format. Reads between one and nine bytes. Smaller values take fewer bytes. Negative numbers are not supported.
virtual void | setModifiedUTF8StringsMode ()
| Call this if readString should read characters stored in the old modified UTF8 format. This is used for indices written pre-2.4.
virtual String | readString ()
| Reads a string.
virtual String | readModifiedUTF8String ()
| Reads a modified UTF8 format string.
virtual int32_t | readChars (wchar_t *buffer, int32_t start, int32_t length)
| Reads Lucene's old "modified UTF-8" encoded characters into an array.
virtual void | skipChars (int32_t length)

Similar to `readChars(wchar_t*, int32_t, int32_t)` but does not do any conversion operations on the bytes it is reading in. It still has to invoke `readByte()` just as `readChars(wchar_t*, int32_t, int32_t)` 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.

virtual void | close ()=0
| Closes the stream to further operations.
virtual int64_t | getFilePointer ()=0
| Returns the current position in this file, where the next read will occur.
virtual void | seek (int64_t pos)=0
| Sets current position in this file, where the next read will occur.
virtual int64_t | length ()=0
| The number of bytes in the file.
virtual LuceneObjectPtr | clone (const LuceneObjectPtr &other=LuceneObjectPtr())
| Returns a clone of this stream.
virtual MapStringString | readStringStringMap ()
| Read string map as a series of key/value pairs.
Public Member Functions inherited from Lucene::LuceneObject
virtual | ~LuceneObject ()
virtual void | initialize ()
| Called directly after instantiation to create objects that depend on this object being fully constructed.
virtual int32_t | hashCode ()
| Return hash code for this object.
virtual bool | equals (const LuceneObjectPtr &other)
| Return whether two objects are equal.
virtual int32_t | compareTo (const LuceneObjectPtr &other)
| Compare two objects.
virtual String | toString ()
| Returns a string representation of the object.
Public Member Functions inherited from Lucene::LuceneSync
virtual | ~LuceneSync ()
virtual SynchronizePtr | getSync ()
| Return this object synchronize lock.
virtual LuceneSignalPtr | getSignal ()
| Return this object signal.
virtual void | lock (int32_t timeout=0)
| Lock this object using an optional timeout.
virtual void | unlock ()
| Unlock this object.
virtual bool | holdsLock ()
| Returns true if this object is currently locked by current thread.
virtual void | wait (int32_t timeout=0)
| Wait for signal using an optional timeout.
virtual void | notifyAll ()
| Notify all threads waiting for signal.

## Static Public Member Functions

static String | _getClassName ()

## Protected Attributes

bool | preUTF8Strings
Protected Attributes inherited from Lucene::LuceneSync
SynchronizePtr | objectLock
LuceneSignalPtr | objectSignal

## Additional Inherited Members

Protected Member Functions inherited from Lucene::LuceneObject
| LuceneObject ()

## Detailed Description

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 & Destructor Documentation

## ◆ IndexInput()

Lucene::IndexInput::IndexInput | ( |  | ) |

Referenced by _getClassName().

## ◆ ~IndexInput()

virtual Lucene::IndexInput::~IndexInput | ( |  | ) |

virtual

## Member Function Documentation

## ◆ _getClassName()

String Lucene::IndexInput::_getClassName | ( |  | ) |

inline static

References IndexInput().

## ◆ clone()

virtual LuceneObjectPtr Lucene::IndexInput::clone | ( | const LuceneObjectPtr & | other = LuceneObjectPtr() | ) |

virtual

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.

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.

Reimplemented from Lucene::LuceneObject.

Reimplemented in Lucene::BufferedIndexInput, Lucene::ChecksumIndexInput, Lucene::CSIndexInput, and Lucene::RAMInputStream.

## ◆ close()

virtual void Lucene::IndexInput::close | ( |  | ) |

pure virtual

Closes the stream to further operations.

Implemented in Lucene::BufferedIndexInput, Lucene::ByteSliceReader, Lucene::ChecksumIndexInput, Lucene::CSIndexInput, Lucene::RAMInputStream, and Lucene::SkipBuffer.

## ◆ getClassName()

virtual String Lucene::IndexInput::getClassName | ( |  | ) |

inline virtual

Reimplemented in Lucene::BufferedIndexInput, Lucene::ByteSliceReader, Lucene::ChecksumIndexInput, Lucene::CSIndexInput, Lucene::RAMInputStream, and Lucene::SkipBuffer.

## ◆ getFilePointer()

virtual int64_t Lucene::IndexInput::getFilePointer | ( |  | ) |

pure virtual

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

See also
  seek(int64_t)

Implemented in Lucene::BufferedIndexInput, Lucene::ByteSliceReader, Lucene::ChecksumIndexInput, Lucene::RAMInputStream, and Lucene::SkipBuffer.

## ◆ length()

virtual int64_t Lucene::IndexInput::length | ( |  | ) |

pure virtual

The number of bytes in the file.

Implemented in Lucene::ByteSliceReader, Lucene::ChecksumIndexInput, Lucene::CSIndexInput, Lucene::RAMInputStream, and Lucene::SkipBuffer.

Referenced by Lucene::BufferedIndexInput::readBytes(), Lucene::BufferedIndexInput::readBytes(), readBytes(), readBytes(), readChars(), Lucene::BufferedIndexInput::readInternal(), and skipChars().

## ◆ readByte()

virtual uint8_t Lucene::IndexInput::readByte | ( |  | ) |

pure virtual

Reads and returns a single byte.

See also
  IndexOutput::writeByte(uint8_t)

Implemented in Lucene::BufferedIndexInput, Lucene::ByteSliceReader, Lucene::ChecksumIndexInput, Lucene::RAMInputStream, and Lucene::SkipBuffer.

## ◆ readBytes() [1/2]

virtual void Lucene::IndexInput::readBytes | ( | uint8_t * | b,
|  | int32_t | offset,
|  | int32_t | length )

pure virtual

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.
  length | the number of bytes to read.

See also
  IndexOutput#writeBytes(const uint8_t*, int)

Implemented in Lucene::BufferedIndexInput, Lucene::ByteSliceReader, Lucene::ChecksumIndexInput, Lucene::RAMInputStream, and Lucene::SkipBuffer.

References length().

## ◆ readBytes() [2/2]

virtual void Lucene::IndexInput::readBytes | ( | uint8_t * | b,
|  | int32_t | offset,
|  | int32_t | length,
|  | bool | useBuffer )

virtual

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.
  length | the number of bytes to read.
  useBuffer | set to false if the caller will handle buffering.

See also
  IndexOutput#writeBytes(const uint8_t*,int)

Reimplemented in Lucene::BufferedIndexInput.

References length().

## ◆ readChars()

virtual int32_t Lucene::IndexInput::readChars | ( | wchar_t * | buffer,
|  | int32_t | start,
|  | int32_t | length )

virtual

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.

See also
  IndexOutput::writeChars(const String& s, int32_t, int32_t)

References length().

## ◆ readInt()

virtual int32_t Lucene::IndexInput::readInt | ( |  | ) |

virtual

Reads four bytes and returns an int.

See also
  IndexOutput::writeInt(int32_t)

## ◆ readLong()

virtual int64_t Lucene::IndexInput::readLong | ( |  | ) |

virtual

Reads eight bytes and returns a int64.

See also
  IndexOutput::writeLong(int64_t)

## ◆ readModifiedUTF8String()

virtual String Lucene::IndexInput::readModifiedUTF8String | ( |  | ) |

virtual

Reads a modified UTF8 format string.

## ◆ readString()

virtual String Lucene::IndexInput::readString | ( |  | ) |

virtual

Reads a string.

See also
  IndexOutput::writeString(const String&)

## ◆ readStringStringMap()

virtual MapStringString Lucene::IndexInput::readStringStringMap | ( |  | ) |

virtual

Read string map as a series of key/value pairs.

## ◆ readVInt()

virtual int32_t Lucene::IndexInput::readVInt | ( |  | ) |

virtual

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

See also
  IndexOutput::writeVInt(int32_t)

Reimplemented in Lucene::BufferedIndexInput.

## ◆ readVLong()

virtual int64_t Lucene::IndexInput::readVLong | ( |  | ) |

virtual

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

## ◆ seek()

virtual void Lucene::IndexInput::seek | ( | int64_t | pos | ) |

pure virtual

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

See also
  getFilePointer()

Implemented in Lucene::BufferedIndexInput, Lucene::ByteSliceReader, Lucene::ChecksumIndexInput, Lucene::RAMInputStream, and Lucene::SkipBuffer.

## ◆ setModifiedUTF8StringsMode()

virtual void Lucene::IndexInput::setModifiedUTF8StringsMode | ( |  | ) |

virtual

Call this if readString should read characters stored in the old modified UTF8 format. This is used for indices written pre-2.4.

## ◆ shared_from_this()

boost::shared_ptr< IndexInput > Lucene::IndexInput::shared_from_this | ( |  | ) |

inline

## ◆ skipChars()

virtual void Lucene::IndexInput::skipChars | ( | int32_t | length | ) |

virtual

Similar to `readChars(wchar_t*, int32_t, int32_t)` but does not do any conversion operations on the bytes it is reading in. It still has to invoke `readByte()` just as `readChars(wchar_t*, int32_t, int32_t)` 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.

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

References length().

## Field Documentation

## ◆ preUTF8Strings

bool Lucene::IndexInput::preUTF8Strings

protected

The documentation for this class was generated from the following file:

- IndexInput.h

clucene.sourceforge.net