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
RAMOutputStream.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 RAMOUTPUTSTREAM_H
8 #define RAMOUTPUTSTREAM_H
9
10 #include "IndexOutput.h"
11
12 namespace Lucene
13 {
15 class RAMOutputStream : public IndexOutput
16 {
17 public:
19 RAMOutputStream();
20 RAMOutputStream(RAMFilePtr f);
21 virtual ~RAMOutputStream();
22
23 LUCENE_CLASS(RAMOutputStream);
24
25 public:
26 static const int32_t BUFFER_SIZE;
27
28 protected:
29 RAMFilePtr file;
30 ByteArray currentBuffer;
31 int32_t currentBufferIndex;
32 int32_t bufferPosition;
33 int64_t bufferStart;
34 int32_t bufferLength;
35
36 public:
38 void writeTo(IndexOutputPtr out);
39
41 void reset();
42
44 virtual void close();
45
48 virtual void seek(int64_t pos);
49
51 virtual int64_t length();
52
55 virtual void writeByte(uint8_t b);
56
61 virtual void writeBytes(const uint8_t* b, int32_t offset, int32_t length);
62
64 virtual void flush();
65
67 virtual int64_t getFilePointer();
68
70 int64_t sizeInBytes();
71
72 protected:
73 void switchCurrentBuffer();
74 void setFileLength();
75 };
76 }
77
78 #endif

clucene.sourceforge.net