Methods Summary |
---|
public void | close()
flush();
|
public org.apache.lucene.store.IndexOutput | createOutput(java.lang.String name)
return new DbIndexOutput(this, name, true);
|
public void | deleteFile(java.lang.String name)
new File(name).delete(this);
|
public boolean | fileExists(java.lang.String name)
return new File(name).exists(this);
|
public long | fileLength(java.lang.String name)
File file = new File(name);
if (file.exists(this))
return file.getLength();
throw new IOException("File does not exist: " + name);
|
public long | fileModified(java.lang.String name)
File file = new File(name);
if (file.exists(this))
return file.getTimeModified();
throw new IOException("File does not exist: " + name);
|
public void | flush()Flush the currently open files. After they have been flushed it is
safe to commit the transaction without closing this DbDirectory
instance first.
Iterator iterator = openFiles.iterator();
while (iterator.hasNext())
((IndexOutput) iterator.next()).flush();
|
public java.lang.String[] | list()
Dbc cursor = null;
List list = new ArrayList();
try {
try {
DatabaseEntry key = new DatabaseEntry(new byte[0]);
DatabaseEntry data = new DatabaseEntry(null);
data.setPartial(true);
cursor = files.cursor(txn, flags);
if (cursor.get(key, data,
DbConstants.DB_SET_RANGE | flags) != DbConstants.DB_NOTFOUND)
{
ByteArrayInputStream buffer =
new ByteArrayInputStream(key.getData());
DataInputStream in = new DataInputStream(buffer);
String name = in.readUTF();
in.close();
list.add(name);
while (cursor.get(key, data,
DbConstants.DB_NEXT | flags) != DbConstants.DB_NOTFOUND) {
buffer = new ByteArrayInputStream(key.getData());
in = new DataInputStream(buffer);
name = in.readUTF();
in.close();
list.add(name);
}
}
} finally {
if (cursor != null)
cursor.close();
}
} catch (DatabaseException e) {
throw new IOException(e.getMessage());
}
return (String[]) list.toArray(new String[list.size()]);
|
public org.apache.lucene.store.Lock | makeLock(java.lang.String name)
return new DbLock();
|
public org.apache.lucene.store.IndexInput | openInput(java.lang.String name)
return new DbIndexInput(this, name);
|
public void | renameFile(java.lang.String from, java.lang.String to)
new File(from).rename(this, to);
|
public void | setTransaction(com.sleepycat.db.Transaction txn)Once a transaction handle was committed it is no longer valid. In
order to continue using this DbDirectory instance after a commit, the
transaction handle has to be replaced.
setTransaction(txn != null ? DbHandleExtractor.getDbTxn(txn) : null);
|
public void | setTransaction(com.sleepycat.db.internal.DbTxn txn)Once a transaction handle was committed it is no longer valid. In
order to continue using this DbDirectory instance after a commit, the
transaction handle has to be replaced.
this.txn = txn;
|
public void | touchFile(java.lang.String name)
File file = new File(name);
long length = 0L;
if (file.exists(this))
length = file.getLength();
file.modify(this, length, System.currentTimeMillis());
|