public final class RawDirectoryWrapper extends BaseDirectoryWrapper
This class is used if you want the most realistic testing, but still with a checkindex on close. If you want asserts and evil things, use MockDirectoryWrapper instead.
isOpenin| Constructor and Description |
|---|
RawDirectoryWrapper(Directory delegate) |
| Modifier and Type | Method and Description |
|---|---|
void |
copyFrom(Directory from,
String src,
String dest,
IOContext context)
Copies the file src in from to this directory under the new
file name dest.
|
protected void |
ensureOpen() |
ChecksumIndexInput |
openChecksumInput(String name,
IOContext context)
Returns a stream reading an existing file, computing checksum as it reads
|
close, getCheckIndexOnClose, getCrossCheckTermVectorsOnClose, isOpen, setCheckIndexOnClose, setCrossCheckTermVectorsOnClosecreateOutput, deleteFile, fileLength, getDelegate, listAll, obtainLock, openInput, renameFile, sync, toString, unwrappublic RawDirectoryWrapper(Directory delegate)
public void copyFrom(Directory from, String src, String dest, IOContext context) throws IOException
DirectoryIf you want to copy the entire source directory to the destination one, you can do so like this:
Directory to; // the directory to copy to
for (String file : dir.listAll()) {
to.copyFrom(dir, file, newFile, IOContext.DEFAULT); // newFile can be either file, or a new name
}
NOTE: this method does not check whether dest exist and will overwrite it if it does.
copyFrom in class DirectoryIOExceptionpublic ChecksumIndexInput openChecksumInput(String name, IOContext context) throws IOException
DirectoryopenChecksumInput in class DirectoryIOExceptionprotected void ensureOpen()
throws AlreadyClosedException
ensureOpen in class DirectoryAlreadyClosedException - if this Directory is closedCopyright © 2000–2015 The Apache Software Foundation. All rights reserved.