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

Loading...
Searching...
No Matches
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 LPPAPI 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
24 LUCENE_CLASS(CompoundFileReader);
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;
36 typedef HashMap<String, FileEntryPtr> MapStringFileEntryPtr;
37
38 DirectoryPtr directory;
39 String fileName;
40 int32_t readBufferSize;
41 IndexInputPtr stream;
42 MapStringFileEntryPtr entries;
43
44 protected:
45 void ConstructReader(const DirectoryPtr& dir, const String& name, int32_t readBufferSize);
46
47 public:
48 DirectoryPtr getDirectory();
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
83 class LPPAPI CSIndexInput : public BufferedIndexInput {
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
90 LUCENE_CLASS(CSIndexInput);
91
92 public:
93 IndexInputPtr base;
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
BufferedIndexInput.h
Directory.h
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition LuceneObject.h:24
Lucene::BufferedIndexInput::BufferedIndexInput
BufferedIndexInput(int32_t bufferSize=BUFFER_SIZE)
Construct BufferedIndexInput with a specific bufferSize.
Lucene::CSIndexInput::CSIndexInput
CSIndexInput(const IndexInputPtr &base, int64_t fileOffset, int64_t length)
Lucene::CSIndexInput::length
virtual int64_t length()
The number of bytes in the file.
Lucene::CSIndexInput::close
virtual void close()
Closes the stream to further operations.
Lucene::CSIndexInput::fileOffset
int64_t fileOffset
Definition CompoundFileReader.h:94
Lucene::CSIndexInput::_length
int64_t _length
Definition CompoundFileReader.h:95
Lucene::CSIndexInput::~CSIndexInput
virtual ~CSIndexInput()
Lucene::CSIndexInput::base
IndexInputPtr base
Definition CompoundFileReader.h:93
Lucene::CSIndexInput::readInternal
virtual void readInternal(uint8_t *b, int32_t offset, int32_t length)
Implements buffer refill. Reads bytes from the current position in the input.
Lucene::CSIndexInput::clone
virtual LuceneObjectPtr clone(const LuceneObjectPtr &other=LuceneObjectPtr())
Returns a clone of this stream.
Lucene::CSIndexInput::CSIndexInput
CSIndexInput()
Lucene::CSIndexInput::CSIndexInput
CSIndexInput(const IndexInputPtr &base, int64_t fileOffset, int64_t length, int32_t readBufferSize)
Lucene::CSIndexInput::seekInternal
virtual void seekInternal(int64_t pos)
Implements seek. Sets current position in this file, where the next readInternal(byte[],...
Lucene::CompoundFileReader::FileEntryPtr
boost::shared_ptr< FileEntry > FileEntryPtr
Definition CompoundFileReader.h:35
Lucene::CompoundFileReader::makeLock
virtual LockPtr makeLock(const String &name)
Not implemented.
Lucene::CompoundFileReader::createOutput
virtual IndexOutputPtr createOutput(const String &name)
Not implemented.
Lucene::CompoundFileReader::openInput
virtual IndexInputPtr openInput(const String &name, int32_t bufferSize)
Returns a stream reading an existing file, with the specified read buffer size. The particular Direct...
Lucene::CompoundFileReader::close
virtual void close()
Closes the store.
Lucene::CompoundFileReader::entries
MapStringFileEntryPtr entries
Definition CompoundFileReader.h:42
Lucene::CompoundFileReader::readBufferSize
int32_t readBufferSize
Definition CompoundFileReader.h:40
Lucene::CompoundFileReader::fileLength
virtual int64_t fileLength(const String &name)
Returns the length of a file in the directory.
Lucene::CompoundFileReader::listAll
virtual HashSet< String > listAll()
Returns an array of strings, one for each file in the directory.
Lucene::CompoundFileReader::touchFile
virtual void touchFile(const String &name)
Set the modified time of the compound file to now.
Lucene::CompoundFileReader::ConstructReader
void ConstructReader(const DirectoryPtr &dir, const String &name, int32_t readBufferSize)
Lucene::CompoundFileReader::fileName
String fileName
Definition CompoundFileReader.h:39
Lucene::CompoundFileReader::CompoundFileReader
CompoundFileReader(const DirectoryPtr &dir, const String &name)
Lucene::CompoundFileReader::openInput
virtual IndexInputPtr openInput(const String &name)
Returns a stream reading an existing file.
Lucene::CompoundFileReader::stream
IndexInputPtr stream
Definition CompoundFileReader.h:41
Lucene::CompoundFileReader::renameFile
virtual void renameFile(const String &from, const String &to)
Not implemented.
Lucene::CompoundFileReader::MapStringFileEntryPtr
HashMap< String, FileEntryPtr > MapStringFileEntryPtr
Definition CompoundFileReader.h:36
Lucene::CompoundFileReader::fileModified
virtual uint64_t fileModified(const String &name)
Returns the time the compound file was last modified.
Lucene::CompoundFileReader::fileExists
virtual bool fileExists(const String &name)
Returns true if a file with the given name exists.
Lucene::CompoundFileReader::CompoundFileReader
CompoundFileReader(const DirectoryPtr &dir, const String &name, int32_t readBufferSize)
Lucene::CompoundFileReader::deleteFile
virtual void deleteFile(const String &name)
Not implemented.
Lucene::CompoundFileReader::directory
DirectoryPtr directory
Definition CompoundFileReader.h:38
Lucene::CompoundFileReader::getName
String getName()
Lucene::CompoundFileReader::~CompoundFileReader
virtual ~CompoundFileReader()
Lucene::CompoundFileReader::getDirectory
DirectoryPtr getDirectory()
Lucene::Directory::Directory
Directory()
Lucene::HashMap
Utility template class to handle hash maps that can be safely copied and shared.
Definition HashMap.h:17
Lucene::HashSet
Utility template class to handle hash set collections that can be safely copied and shared.
Definition HashSet.h:17
Lucene
Definition AbstractAllTermDocs.h:12
Lucene::IndexInputPtr
boost::shared_ptr< IndexInput > IndexInputPtr
Definition LuceneTypes.h:493
Lucene::DirectoryPtr
boost::shared_ptr< Directory > DirectoryPtr
Definition LuceneTypes.h:489
Lucene::IndexOutputPtr
boost::shared_ptr< IndexOutput > IndexOutputPtr
Definition LuceneTypes.h:494
Lucene::LuceneObjectPtr
boost::shared_ptr< LuceneObject > LuceneObjectPtr
Definition LuceneTypes.h:539
Lucene::LockPtr
boost::shared_ptr< Lock > LockPtr
Definition LuceneTypes.h:496
Lucene::CompoundFileReader::FileEntry::FileEntry
FileEntry(int64_t offset=0, int64_t length=0)
Definition CompoundFileReader.h:28
Lucene::CompoundFileReader::FileEntry::offset
int64_t offset
Definition CompoundFileReader.h:32
Lucene::CompoundFileReader::FileEntry::length
int64_t length
Definition CompoundFileReader.h:33

clucene.sourceforge.net