Class PersistenceUtils
- java.lang.Object
-
- org.torproject.metrics.collector.persist.PersistenceUtils
-
public class PersistenceUtils extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
TEMPFIX
-
Constructor Summary
Constructors Constructor Description PersistenceUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
cleanDirectory(java.nio.file.Path pathToClean)
Move temporary files to their final location.static void
cleanDirectory(java.nio.file.Path pathToClean, long cutOffMillis)
Clean up the given directory by deleting files that are older than the given cut-off timestamp, and by moving temporary files to their final location.static void
cleanDirectory(java.nio.file.Path pathToClean, long cutOffMillis, java.nio.file.Path pathToExclude)
Clean up the given directory, excluding the given subdirectory, by deleting files that are older than the given cut-off timestamp, and by moving temporary files to their final location.static java.lang.String
dateTime(long dateTime)
Return all date-time as string.static java.lang.String
dateTime(java.util.Date dateTime)
Return all date-time as string.static java.lang.String[]
dateTimeParts(long dateTime)
Return all date-time parts as array.static java.lang.String[]
dateTimeParts(java.util.Date dateTime)
Return all date-time parts as array.static boolean
storeToFileSystem(byte[] typeAnnotation, byte[] data, java.nio.file.Path outputPath, java.nio.file.StandardOpenOption option)
Stores a descriptor adding missing annotations with the given options.static boolean
storeToFileSystem(byte[] typeAnnotation, byte[] data, java.nio.file.Path outputPath, java.nio.file.StandardOpenOption option, boolean useTmp)
Stores a descriptor adding missing annotations with the given options.
-
-
-
Field Detail
-
TEMPFIX
public static final java.lang.String TEMPFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
storeToFileSystem
public static boolean storeToFileSystem(byte[] typeAnnotation, byte[] data, java.nio.file.Path outputPath, java.nio.file.StandardOpenOption option)
Stores a descriptor adding missing annotations with the given options.
-
storeToFileSystem
public static boolean storeToFileSystem(byte[] typeAnnotation, byte[] data, java.nio.file.Path outputPath, java.nio.file.StandardOpenOption option, boolean useTmp)
Stores a descriptor adding missing annotations with the given options. Uses a temporary file and requires a run of cleanDirectory for moving files to the final location.
-
cleanDirectory
public static void cleanDirectory(java.nio.file.Path pathToClean)
Move temporary files to their final location.
-
cleanDirectory
public static void cleanDirectory(java.nio.file.Path pathToClean, long cutOffMillis)
Clean up the given directory by deleting files that are older than the given cut-off timestamp, and by moving temporary files to their final location.
-
cleanDirectory
public static void cleanDirectory(java.nio.file.Path pathToClean, long cutOffMillis, java.nio.file.Path pathToExclude)
Clean up the given directory, excluding the given subdirectory, by deleting files that are older than the given cut-off timestamp, and by moving temporary files to their final location.
-
dateTimeParts
public static java.lang.String[] dateTimeParts(long dateTime)
Return all date-time parts as array.
-
dateTimeParts
public static java.lang.String[] dateTimeParts(java.util.Date dateTime)
Return all date-time parts as array.
-
dateTime
public static java.lang.String dateTime(long dateTime)
Return all date-time as string.
-
dateTime
public static java.lang.String dateTime(java.util.Date dateTime)
Return all date-time as string.
-
-