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


BufferedIndexOutput.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 BUFFEREDINDEXOUTPUT_H
8 #define BUFFEREDINDEXOUTPUT_H
9 
10 #include "IndexOutput.h"
11 
12 namespace Lucene {
13 
15 class LPPAPI BufferedIndexOutput : public IndexOutput {
16 public:
19 
21 
22 public:
23  static const int32_t BUFFER_SIZE;
24 
25 protected:
26  int64_t bufferStart; // position in file of buffer
27  int32_t bufferPosition; // position in buffer
28  ByteArray buffer;
29 
30 public:
33  virtual void writeByte(uint8_t b);
34 
39  virtual void writeBytes(const uint8_t* b, int32_t offset, int32_t length);
40 
42  virtual void flush();
43 
49  virtual void flushBuffer(const uint8_t* b, int32_t offset, int32_t length);
50 
52  virtual void close();
53 
56  virtual int64_t getFilePointer();
57 
60  virtual void seek(int64_t pos);
61 
63  virtual int64_t length() = 0;
64 
65 protected:
70  void flushBuffer(const uint8_t* b, int32_t length);
71 };
72 
73 }
74 
75 #endif
Lucene::BufferedIndexOutput
Base implementation class for buffered IndexOutput.
Definition: BufferedIndexOutput.h:15
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Lucene::BufferedIndexOutput::close
virtual void close()
Closes this stream to further operations.
IndexOutput.h
Lucene::BufferedIndexOutput::seek
virtual void seek(int64_t pos)
Sets current position in this file, where the next write will occur.
Lucene::BufferedIndexOutput::writeBytes
virtual void writeBytes(const uint8_t *b, int32_t offset, int32_t length)
Writes an array of bytes.
Lucene::BufferedIndexOutput::getFilePointer
virtual int64_t getFilePointer()
Returns the current position in this file, where the next write will occur.
Lucene::BufferedIndexOutput::length
virtual int64_t length()=0
The number of bytes in the file.
Lucene::BufferedIndexOutput::writeByte
virtual void writeByte(uint8_t b)
Writes a single byte.
Lucene::BufferedIndexOutput::bufferPosition
int32_t bufferPosition
Definition: BufferedIndexOutput.h:27
Lucene::BufferedIndexOutput::bufferStart
int64_t bufferStart
Definition: BufferedIndexOutput.h:26
Lucene
Definition: AbstractAllTermDocs.h:12
Lucene::BufferedIndexOutput::BufferedIndexOutput
BufferedIndexOutput()
Lucene::BufferedIndexOutput::~BufferedIndexOutput
virtual ~BufferedIndexOutput()
Lucene::BufferedIndexOutput::buffer
ByteArray buffer
Definition: BufferedIndexOutput.h:28
Lucene::BufferedIndexOutput::flush
virtual void flush()
Forces any buffered output to be written.
Lucene::IndexOutput
Abstract base class for output to a file in a Directory. A random-access output stream....
Definition: IndexOutput.h:18
Lucene::BufferedIndexOutput::BUFFER_SIZE
static const int32_t BUFFER_SIZE
Definition: BufferedIndexOutput.h:20
Lucene::BufferedIndexOutput::flushBuffer
void flushBuffer(const uint8_t *b, int32_t length)
Implements buffer write. Writes bytes at the current position in the output.
Lucene::BufferedIndexOutput::flushBuffer
virtual void flushBuffer(const uint8_t *b, int32_t offset, int32_t length)
Implements buffer write. Writes bytes at the current position in the output.

clucene.sourceforge.net