| Modifier and Type | Method and Description |
|---|---|
static Env |
createEnv() |
static Env |
createEnv(MmapLimiter mmapLimiter) |
File |
createTempDir(String prefix)
Create a temporary directory in filesystem
|
WritableFile |
newAppendableFile(File file)
Create an WritableFile that either appends to an existing file, or
writes to a new file (if the file does not exist to begin with).
|
Logger |
newLogger(File loggerFile)
Create and return a log file for storing informational messages.
|
RandomInputFile |
newRandomAccessFile(File file)
Create a brand new random access read-only file with the
specified file name.
|
SequentialFile |
newSequentialFile(File file)
Create a brand new sequentially-readable file with the specified file name.
|
WritableFile |
newWritableFile(File file)
Create an object that writes to a new file with the specified
name.
|
long |
nowMicros() |
String |
readFileToString(File file)
Read full file content to string
|
File |
toFile(String filename)
|
DbLock |
tryLock(File file)
Attempts to acquire an exclusive lock on this file
|
void |
writeStringToFileSync(File file,
String content)
Write
content to file. |
public static Env createEnv()
public static Env createEnv(MmapLimiter mmapLimiter)
public File createTempDir(String prefix)
EnvcreateTempDir in interface Envprefix - prefix to use as namepublic SequentialFile newSequentialFile(File file) throws IOException
EnvnewSequentialFile in interface EnvIOException - If the file does not exist or inaccessible.public RandomInputFile newRandomAccessFile(File file) throws IOException
EnvnewRandomAccessFile in interface EnvIOException - If the file does not exist or inaccessible.public WritableFile newWritableFile(File file) throws IOException
EnvnewWritableFile in interface EnvIOException - If the file not writable.public WritableFile newAppendableFile(File file) throws IOException
EnvMay return an IsNotSupportedError error if this Env does not allow appending to an existing file. Users of Env (including the leveldb implementation) must be prepared to deal with an Env that does not support appending. TODO
newAppendableFile in interface EnvIOException - If the file is inaccessible.public void writeStringToFileSync(File file, String content) throws IOException
Envcontent to file. Replace existing content.writeStringToFileSync in interface Envfile - file locationcontent - new contentIOException - If the file not writable.public String readFileToString(File file) throws IOException
EnvreadFileToString in interface Envfile - file locationIOException - If the file not readable.public Logger newLogger(File loggerFile) throws IOException
EnvnewLogger in interface EnvloggerFile - logger filenull otherwiseIOExceptionpublic DbLock tryLock(File file) throws IOException
tryLock in interface Envfile - lock fileIOException - If lock is already held or some other I/O error occursCopyright © 2011–2020. All rights reserved.