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

Loading...
Searching...
No Matches
BufferedIndexInput.h
Go to the documentation of this file.
1
2// Copyright (c) 2009-2014 Alan Wright. All rights reserved.
3// Distributable under the terms of either the Apache License (Version 2.0)
4// or the GNU Lesser General Public License.
6
7#ifndef BUFFEREDINDEXINPUT_H
8#define BUFFEREDINDEXINPUT_H
9
10#include "IndexInput.h"
11
12 namespace Lucene {
13
15 class LPPAPI BufferedIndexInput : public IndexInput {
16 public:
18 BufferedIndexInput(int32_t bufferSize = BUFFER_SIZE);
19 virtual ~BufferedIndexInput();
20
21 LUCENE_CLASS(BufferedIndexInput);
22
23 public:
25 static const int32_t BUFFER_SIZE;
26
27 protected:
28 int32_t bufferSize;
29 int64_t bufferStart; // position in file of buffer
30 int32_t bufferLength; // end of valid bytes
31 int32_t bufferPosition; // next byte to read
32 ByteArray buffer;
33 decltype(buffer.get()) __buffer;
34
35 public:
38 virtual uint8_t readByte();
39
43 virtual int32_t readVInt();
44
46 void setBufferSize(int32_t newSize);
47
50 int32_t getBufferSize();
51
58 virtual void readBytes(uint8_t* b, int32_t offset, int32_t length);
59
69 virtual void readBytes(uint8_t* b, int32_t offset, int32_t length, bool useBuffer);
70
72 virtual void close();
73
76 virtual int64_t getFilePointer();
77
81 virtual void seek(int64_t pos);
82
84 virtual LuceneObjectPtr clone(const LuceneObjectPtr& other = LuceneObjectPtr());
85
86 protected:
87 virtual void newBuffer(ByteArray newBuffer);
88
89 void checkBufferSize(int32_t bufferSize);
90
94 virtual void refill();
95
100 virtual void readInternal(uint8_t* b, int32_t offset, int32_t length) = 0;
101
106 virtual void seekInternal(int64_t pos) = 0;
107};
108
109}
110
111#endif
IndexInput.h
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition LuceneObject.h:24
Lucene::BufferedIndexInput::bufferLength
int32_t bufferLength
Definition BufferedIndexInput.h:30
Lucene::BufferedIndexInput::newBuffer
virtual void newBuffer(ByteArray newBuffer)
Lucene::BufferedIndexInput::setBufferSize
void setBufferSize(int32_t newSize)
Change the buffer size used by this IndexInput.
Lucene::BufferedIndexInput::~BufferedIndexInput
virtual ~BufferedIndexInput()
Lucene::BufferedIndexInput::close
virtual void close()
Closes the stream to further operations.
Lucene::BufferedIndexInput::getBufferSize
int32_t getBufferSize()
Returns buffer size.
Lucene::BufferedIndexInput::refill
virtual void refill()
Refill buffer in preparation for reading.
Lucene::BufferedIndexInput::checkBufferSize
void checkBufferSize(int32_t bufferSize)
Lucene::BufferedIndexInput::bufferSize
int32_t bufferSize
Definition BufferedIndexInput.h:28
Lucene::BufferedIndexInput::readVInt
virtual int32_t readVInt()
Reads an int stored in variable-length format. Reads between one and five bytes. Smaller values take ...
Lucene::BufferedIndexInput::BufferedIndexInput
BufferedIndexInput(int32_t bufferSize=BUFFER_SIZE)
Construct BufferedIndexInput with a specific bufferSize.
Lucene::BufferedIndexInput::BUFFER_SIZE
static const int32_t BUFFER_SIZE
Default buffer size.
Definition BufferedIndexInput.h:25
Lucene::BufferedIndexInput::readByte
virtual uint8_t readByte()
Reads and returns a single byte.
Lucene::BufferedIndexInput::readBytes
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...
Lucene::BufferedIndexInput::getFilePointer
virtual int64_t getFilePointer()
Returns the current position in this file, where the next read will occur.
Lucene::BufferedIndexInput::clone
virtual LuceneObjectPtr clone(const LuceneObjectPtr &other=LuceneObjectPtr())
Returns a clone of this stream.
Lucene::BufferedIndexInput::readBytes
virtual void readBytes(uint8_t *b, int32_t offset, int32_t length)
Reads a specified number of bytes into an array at the specified offset.
Lucene::BufferedIndexInput::bufferStart
int64_t bufferStart
Definition BufferedIndexInput.h:29
Lucene::BufferedIndexInput::seek
virtual void seek(int64_t pos)
Sets current position in this file, where the next read will occur.
Lucene::BufferedIndexInput::bufferPosition
int32_t bufferPosition
Definition BufferedIndexInput.h:31
Lucene::BufferedIndexInput::readInternal
virtual void readInternal(uint8_t *b, int32_t offset, int32_t length)=0
Implements buffer refill. Reads bytes from the current position in the input.
Lucene::BufferedIndexInput::seekInternal
virtual void seekInternal(int64_t pos)=0
Implements seek. Sets current position in this file, where the next readInternal(uint8_t*,...
Lucene::BufferedIndexInput::__buffer
decltype(buffer.get()) __buffer
Definition BufferedIndexInput.h:33
Lucene::BufferedIndexInput::buffer
ByteArray buffer
Definition BufferedIndexInput.h:32
Lucene::IndexInput::IndexInput
IndexInput()
Lucene::IndexInput::length
virtual int64_t length()=0
The number of bytes in the file.
Lucene
Definition AbstractAllTermDocs.h:12
Lucene::LuceneObjectPtr
boost::shared_ptr< LuceneObject > LuceneObjectPtr
Definition LuceneTypes.h:539

clucene.sourceforge.net