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.
isOpen
in
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, setCrossCheckTermVectorsOnClose
createOutput, deleteFile, fileLength, getDelegate, listAll, obtainLock, openInput, renameFile, sync, toString, unwrap
public RawDirectoryWrapper(Directory delegate)
public void copyFrom(Directory from, String src, String dest, IOContext context) throws IOException
Directory
If 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 Directory
IOException
public ChecksumIndexInput openChecksumInput(String name, IOContext context) throws IOException
Directory
openChecksumInput
in class Directory
IOException
protected void ensureOpen() throws AlreadyClosedException
ensureOpen
in class Directory
AlreadyClosedException
- if this Directory is closedCopyright © 2000–2015 The Apache Software Foundation. All rights reserved.