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

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files

- File List
- Globals

BufferedIndexInput.h
Go to the documentation of this file.
1 // 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
34 public:
37 virtual uint8_t readByte();
38
40 void setBufferSize(int32_t newSize);
41
44 int32_t getBufferSize();
45
52 virtual void readBytes(uint8_t* b, int32_t offset, int32_t length);
53
63 virtual void readBytes(uint8_t* b, int32_t offset, int32_t length, bool useBuffer);
64
66 virtual void close();
67
70 virtual int64_t getFilePointer();
71
75 virtual void seek(int64_t pos);
76
78 virtual LuceneObjectPtr clone(const LuceneObjectPtr& other = LuceneObjectPtr());
79
80 protected:
81 virtual void newBuffer(ByteArray newBuffer);
82
83 void checkBufferSize(int32_t bufferSize);
84
88 virtual void refill();
89
94 virtual void readInternal(uint8_t* b, int32_t offset, int32_t length) = 0;
95
100 virtual void seekInternal(int64_t pos) = 0;
101 };
102
103 }
104
105 #endif
Lucene::LuceneObjectPtr
boost::shared_ptr< LuceneObject > LuceneObjectPtr
Definition: LuceneTypes.h:539
IndexInput.h
Lucene::BufferedIndexInput::bufferStart
int64_t bufferStart
Definition: BufferedIndexInput.h:29
Lucene::BufferedIndexInput
Base implementation class for buffered IndexInput.
Definition: BufferedIndexInput.h:15
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Lucene
Definition: AbstractAllTermDocs.h:12
Lucene::BufferedIndexInput::bufferPosition
int32_t bufferPosition
Definition: BufferedIndexInput.h:31
Lucene::BufferedIndexInput::bufferLength
int32_t bufferLength
Definition: BufferedIndexInput.h:30
Lucene::IndexInput
Abstract base class for input from a file in a Directory. A random-access input stream. Used for all Lucene index input operations.
Definition: IndexInput.h:17
Lucene::BufferedIndexInput::buffer
ByteArray buffer
Definition: BufferedIndexInput.h:32
Lucene::BufferedIndexInput::bufferSize
int32_t bufferSize
Definition: BufferedIndexInput.h:28

clucene.sourceforge.net