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


 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
RAMOutputStream.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 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

clucene.sourceforge.net