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


RAMOutputStream.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 RAMOUTPUTSTREAM_H
8 #define RAMOUTPUTSTREAM_H
9 
10 #include "IndexOutput.h"
11 
12 namespace Lucene {
13 
15 class RAMOutputStream : public IndexOutput {
16 public:
19  RAMOutputStream(const RAMFilePtr& f);
20  virtual ~RAMOutputStream();
21 
23 
24 public:
25  static const int32_t BUFFER_SIZE;
26 
27 protected:
29  ByteArray currentBuffer;
31  int32_t bufferPosition;
32  int64_t bufferStart;
33  int32_t bufferLength;
34 
35 public:
37  void writeTo(const IndexOutputPtr& out);
38 
40  void reset();
41 
43  virtual void close();
44 
47  virtual void seek(int64_t pos);
48 
50  virtual int64_t length();
51 
54  virtual void writeByte(uint8_t b);
55 
60  virtual void writeBytes(const uint8_t* b, int32_t offset, int32_t length);
61 
63  virtual void flush();
64 
66  virtual int64_t getFilePointer();
67 
69  int64_t sizeInBytes();
70 
71 protected:
72  void switchCurrentBuffer();
73  void setFileLength();
74 };
75 
76 }
77 
78 #endif
Lucene::RAMOutputStream::sizeInBytes
int64_t sizeInBytes()
Returns byte usage of all buffers.
Lucene::RAMOutputStream::getFilePointer
virtual int64_t getFilePointer()
Returns the current position in this file, where the next write will occur.
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Lucene::RAMOutputStream::currentBuffer
ByteArray currentBuffer
Definition: RAMOutputStream.h:29
Lucene::RAMOutputStream::bufferLength
int32_t bufferLength
Definition: RAMOutputStream.h:33
Lucene::RAMOutputStream::switchCurrentBuffer
void switchCurrentBuffer()
Lucene::RAMOutputStream::RAMOutputStream
RAMOutputStream()
Construct an empty output buffer.
Lucene::RAMOutputStream::~RAMOutputStream
virtual ~RAMOutputStream()
Lucene::RAMOutputStream::setFileLength
void setFileLength()
IndexOutput.h
Lucene::RAMOutputStream
A memory-resident IndexOutput implementation.
Definition: RAMOutputStream.h:15
Lucene::RAMOutputStream::bufferPosition
int32_t bufferPosition
Definition: RAMOutputStream.h:31
Lucene::RAMFilePtr
boost::shared_ptr< RAMFile > RAMFilePtr
Definition: LuceneTypes.h:506
Lucene::RAMOutputStream::reset
void reset()
Resets this to an empty file.
Lucene::RAMOutputStream::bufferStart
int64_t bufferStart
Definition: RAMOutputStream.h:32
Lucene::RAMOutputStream::length
virtual int64_t length()
The number of bytes in the file.
Lucene
Definition: AbstractAllTermDocs.h:12
Lucene::RAMOutputStream::writeBytes
virtual void writeBytes(const uint8_t *b, int32_t offset, int32_t length)
Writes an array of bytes.
Lucene::RAMOutputStream::BUFFER_SIZE
static const int32_t BUFFER_SIZE
Definition: RAMOutputStream.h:22
Lucene::RAMOutputStream::writeTo
void writeTo(const IndexOutputPtr &out)
Copy the current contents of this buffer to the named output.
Lucene::RAMOutputStream::seek
virtual void seek(int64_t pos)
Sets current position in this file, where the next write will occur.
Lucene::IndexOutput
Abstract base class for output to a file in a Directory. A random-access output stream....
Definition: IndexOutput.h:18
Lucene::RAMOutputStream::currentBufferIndex
int32_t currentBufferIndex
Definition: RAMOutputStream.h:30
Lucene::RAMOutputStream::file
RAMFilePtr file
Definition: RAMOutputStream.h:28
Lucene::RAMOutputStream::writeByte
virtual void writeByte(uint8_t b)
Writes a single byte.
Lucene::RAMOutputStream::flush
virtual void flush()
Forces any buffered output to be written.
Lucene::RAMOutputStream::close
virtual void close()
Closes this stream to further operations.
Lucene::IndexOutputPtr
boost::shared_ptr< IndexOutput > IndexOutputPtr
Definition: LuceneTypes.h:494

clucene.sourceforge.net