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


RAMInputStream.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 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
Lucene::RAMInputStream::bufferPosition
int32_t bufferPosition
Definition: RAMInputStream.h:31
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Lucene::RAMInputStream::BUFFER_SIZE
static const int32_t BUFFER_SIZE
Definition: RAMInputStream.h:21
Lucene::RAMInputStream::currentBuffer
ByteArray currentBuffer
Definition: RAMInputStream.h:29
Lucene::LuceneObjectPtr
boost::shared_ptr< LuceneObject > LuceneObjectPtr
Definition: LuceneTypes.h:539
Lucene::RAMInputStream::close
virtual void close()
Closes the stream to further operations.
Lucene::RAMFilePtr
boost::shared_ptr< RAMFile > RAMFilePtr
Definition: LuceneTypes.h:506
Lucene::RAMInputStream::currentBufferIndex
int32_t currentBufferIndex
Definition: RAMInputStream.h:30
Lucene::IndexInput
Abstract base class for input from a file in a Directory. A random-access input stream....
Definition: IndexInput.h:17
Lucene::RAMInputStream::~RAMInputStream
virtual ~RAMInputStream()
Lucene::RAMInputStream::switchCurrentBuffer
void switchCurrentBuffer(bool enforceEOF)
Lucene::RAMInputStream
A memory-resident IndexInput implementation.
Definition: RAMInputStream.h:15
Lucene::RAMInputStream::clone
virtual LuceneObjectPtr clone(const LuceneObjectPtr &other=LuceneObjectPtr())
Returns a clone of this stream.
Lucene::RAMInputStream::getFilePointer
virtual int64_t getFilePointer()
Returns the current position in this file, where the next read will occur.
Lucene::RAMInputStream::_length
int64_t _length
Definition: RAMInputStream.h:28
Lucene
Definition: AbstractAllTermDocs.h:12
Lucene::RAMInputStream::bufferLength
int32_t bufferLength
Definition: RAMInputStream.h:33
Lucene::RAMInputStream::length
virtual int64_t length()
The number of bytes in the file.
Lucene::RAMInputStream::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.
IndexInput.h
Lucene::RAMInputStream::file
RAMFilePtr file
Definition: RAMInputStream.h:27
Lucene::RAMInputStream::seek
virtual void seek(int64_t pos)
Sets current position in this file, where the next read will occur.
Lucene::RAMInputStream::readByte
virtual uint8_t readByte()
Reads and returns a single byte.
Lucene::RAMInputStream::bufferStart
int64_t bufferStart
Definition: RAMInputStream.h:32
Lucene::RAMInputStream::RAMInputStream
RAMInputStream()

clucene.sourceforge.net