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


 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
RAMInputStream.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 RAMINPUTSTREAM_H
8 #define RAMINPUTSTREAM_H
9 
10 #include "IndexInput.h"
11 
12 namespace Lucene {
13 
15 class RAMInputStream : public IndexInput {
16 public:
18  RAMInputStream(const RAMFilePtr& f);
19  virtual ~RAMInputStream();
20 
22 
23 public:
24  static const int32_t BUFFER_SIZE;
25 
26 protected:
28  int64_t _length;
29  ByteArray currentBuffer;
31  int32_t bufferPosition;
32  int64_t bufferStart;
33  int32_t bufferLength;
34 
35 public:
37  virtual void close();
38 
40  virtual int64_t length();
41 
44  virtual uint8_t readByte();
45 
51  virtual void readBytes(uint8_t* b, int32_t offset, int32_t length);
52 
55  virtual int64_t getFilePointer();
56 
59  virtual void seek(int64_t pos);
60 
62  virtual LuceneObjectPtr clone(const LuceneObjectPtr& other = LuceneObjectPtr());
63 
64 protected:
65  void switchCurrentBuffer(bool enforceEOF);
66 };
67 
68 }
69 
70 #endif

clucene.sourceforge.net