public enum NutDiskStore extends Enum<NutDiskStore> implements Runnable
This class stores nuts in a dedicated temporary directory. The class keeps all version numbers of nuts when they are
stored so the file is actually copied only if its number version is changed in order to boost performances. A thread
is registered via Runtime.addShutdownHook(Thread)
to clean directory when JVM stops properly.
Enum Constant and Description |
---|
INSTANCE
Singleton.
|
Modifier and Type | Method and Description |
---|---|
File |
getWorkingDirectory()
Gets the working directory.
|
void |
run() |
File |
store(ConvertibleNut nut)
Creates a
File for the given nut and returns the object created for the stored file. |
static NutDiskStore |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static NutDiskStore[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final NutDiskStore INSTANCE
public static NutDiskStore[] values()
for (NutDiskStore c : NutDiskStore.values()) System.out.println(c);
public static NutDiskStore valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic File getWorkingDirectory()
Gets the working directory.
public File store(ConvertibleNut nut) throws IOException, InterruptedException, ExecutionException
Creates a File
for the given nut and returns the object created for the stored file.
null
will be returned if the file already exists and has the same version number.
nut
- the nut to storeIOException
- if file cannot be createdInterruptedException
- if version number can't be retrievedExecutionException
- if version number can't be retrievedCopyright © 2012-2015. All Rights Reserved.