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

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

- File List
- Globals

All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
BufferedIndexInput.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2011 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 {
17 public:
19 BufferedIndexInput(int32_t bufferSize = BUFFER_SIZE);
20 virtual ~BufferedIndexInput();
21
22 LUCENE_CLASS(BufferedIndexInput);
23
24 public:
26 static const int32_t BUFFER_SIZE;
27
28 protected:
29 int32_t bufferSize;
30 int64_t bufferStart; // position in file of buffer
31 int32_t bufferLength; // end of valid bytes
32 int32_t bufferPosition; // next byte to read
33 ByteArray buffer;
34
35 public:
38 virtual uint8_t readByte();
39
41 void setBufferSize(int32_t newSize);
42
45 int32_t getBufferSize();
46
53 virtual void readBytes(uint8_t* b, int32_t offset, int32_t length);
54
64 virtual void readBytes(uint8_t* b, int32_t offset, int32_t length, bool useBuffer);
65
67 virtual void close();
68
71 virtual int64_t getFilePointer();
72
76 virtual void seek(int64_t pos);
77
79 virtual LuceneObjectPtr clone(LuceneObjectPtr other = LuceneObjectPtr());
80
81 protected:
82 virtual void newBuffer(ByteArray newBuffer);
83
84 void checkBufferSize(int32_t bufferSize);
85
89 virtual void refill();
90
95 virtual void readInternal(uint8_t* b, int32_t offset, int32_t length) = 0;
96
101 virtual void seekInternal(int64_t pos) = 0;
102 };
103 }
104
105 #endif

clucene.sourceforge.net