public class ReliableFile extends Object
Modifier and Type | Field and Description |
---|---|
static int |
GENERATION_LATEST
Use the last generation of the file
|
static int |
GENERATIONS_INFINITE
Keep infinite backup files
|
static int |
OPEN_BEST_AVAILABLE
Open mask.
|
static int |
OPEN_FAIL_ON_PRIMARY
Open mask.
|
static String |
PROP_MAX_BUFFER
Property to set the maximum size of a file that will be buffered.
|
static String |
PROP_MAX_GENERATIONS
The maximum number of generations to keep as backup files in case last generation
file is determined to be invalid.
|
static String |
PROP_OSGI_LOCKING |
static String |
tmpExt
Extension of tmp file used during writing.
|
Modifier and Type | Method and Description |
---|---|
static void |
cleanupGenerations(File base)
Delete any old excess generations of a given reliable file.
|
static boolean |
delete(File deleteFile)
Delete the specified reliable file on the underlying file system.
|
static boolean |
exists(File file)
Answers a boolean indicating whether or not the specified reliable file
exists on the underlying file system.
|
static void |
fileUpdated(File file)
Inform ReliableFile that a file has been updated outside of
ReliableFile.
|
static String[] |
getBaseFiles(File directory)
Get a list of ReliableFile base names in a given directory.
|
long |
lastModified()
Returns the time that this ReliableFile was last modified.
|
static long |
lastModified(File file)
Returns the time that the reliable file was last modified.
|
static int |
lastModifiedVersion(File file)
Returns the a version number of a reliable managed file.
|
public static final int OPEN_BEST_AVAILABLE
OPEN_FAIL_ON_PRIMARY
.public static final int OPEN_FAIL_ON_PRIMARY
OPEN_BEST_AVAILABLE
.public static final int GENERATION_LATEST
public static final int GENERATIONS_INFINITE
public static final String tmpExt
public static final String PROP_MAX_BUFFER
BufferedInputStream
and reset the buffer to avoid having to read the data from the
media twice. Since this method require memory for storage, it is limited to this size. The default
maximum is 128-KBytes.public static final String PROP_MAX_GENERATIONS
public static final String PROP_OSGI_LOCKING
public static boolean exists(File file)
file
- returns true if the specified reliable file exists; otherwise false is returnedtrue
if the specified reliable file exists,
false
otherwise.public static long lastModified(File file)
file
- the file to determine the time of.public long lastModified()
public static int lastModifiedVersion(File file)
file
- the file to determine the version of.public static boolean delete(File deleteFile)
deleteFile
- the reliable file to deletetrue
if the specified reliable file was deleted,
false
otherwise.public static String[] getBaseFiles(File directory) throws IOException
directory
- the directory to inquire.IOException
- if an error occurs.public static void cleanupGenerations(File base)
base
- realible file.public static void fileUpdated(File file)
file
- Copyright © 2007–2018 The Apache Software Foundation. All rights reserved.