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


 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
CompoundFileReader.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 COMPOUNDFILEREADER_H
8 #define COMPOUNDFILEREADER_H
9 
10 #include "Directory.h"
11 #include "BufferedIndexInput.h"
12 
13 namespace Lucene {
14 
18 class CompoundFileReader : public Directory {
19 public:
20  CompoundFileReader(const DirectoryPtr& dir, const String& name);
21  CompoundFileReader(const DirectoryPtr& dir, const String& name, int32_t readBufferSize);
22  virtual ~CompoundFileReader();
23 
25 
26 protected:
27  struct FileEntry {
28  FileEntry(int64_t offset = 0, int64_t length = 0) {
29  this->offset = offset;
30  this->length = length;
31  }
32  int64_t offset;
33  int64_t length;
34  };
35  typedef boost::shared_ptr<FileEntry> FileEntryPtr;
37 
39  String fileName;
40  int32_t readBufferSize;
43 
44 protected:
45  void ConstructReader(const DirectoryPtr& dir, const String& name, int32_t readBufferSize);
46 
47 public:
49  String getName();
50  virtual void close();
51  virtual IndexInputPtr openInput(const String& name);
52  virtual IndexInputPtr openInput(const String& name, int32_t bufferSize);
53 
55  virtual HashSet<String> listAll();
56 
58  virtual bool fileExists(const String& name);
59 
61  virtual uint64_t fileModified(const String& name);
62 
64  virtual void touchFile(const String& name);
65 
67  virtual void deleteFile(const String& name);
68 
70  virtual void renameFile(const String& from, const String& to);
71 
73  virtual int64_t fileLength(const String& name);
74 
76  virtual IndexOutputPtr createOutput(const String& name);
77 
79  virtual LockPtr makeLock(const String& name);
80 };
81 
84 public:
85  CSIndexInput();
86  CSIndexInput(const IndexInputPtr& base, int64_t fileOffset, int64_t length);
87  CSIndexInput(const IndexInputPtr& base, int64_t fileOffset, int64_t length, int32_t readBufferSize);
88  virtual ~CSIndexInput();
89 
91 
92 public:
94  int64_t fileOffset;
95  int64_t _length;
96 
97 public:
99  virtual void close();
100 
101  virtual int64_t length();
102 
104  virtual LuceneObjectPtr clone(const LuceneObjectPtr& other = LuceneObjectPtr());
105 
106 protected:
111  virtual void readInternal(uint8_t* b, int32_t offset, int32_t length);
112 
115  virtual void seekInternal(int64_t pos);
116 };
117 
118 }
119 
120 #endif

clucene.sourceforge.net