Class GenerationFileHandler
java.lang.Object
java.util.logging.Handler
java.util.logging.StreamHandler
java.util.logging.FileHandler
org.archive.io.GenerationFileHandler
FileHandler with support for rotating the current file to
an archival name with a specified integer suffix, and
provision of a new replacement FileHandler with the current
filename.
- Author:
- gojomo
-
Constructor Summary
ConstructorsConstructorDescriptionGenerationFileHandler(String pattern, boolean append, boolean shouldManifest) Constructor.GenerationFileHandler(LinkedList<String> filenameSeries, boolean shouldManifest) -
Method Summary
Modifier and TypeMethodDescriptionstatic GenerationFileHandlerConstructor-helper that rather than clobbering any existing file, moves it aside with a timestamp suffix.voidMove the current file to a new filename with the storeSuffix in place of the activeSuffix; continuing logging to a new file under the original filename.booleanMethods inherited from class java.util.logging.FileHandler
closeMethods inherited from class java.util.logging.StreamHandler
flush, isLoggable, setEncoding, setOutputStreamMethods inherited from class java.util.logging.Handler
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, reportError, setErrorManager, setFilter, setFormatter, setLevel
-
Constructor Details
-
GenerationFileHandler
public GenerationFileHandler(String pattern, boolean append, boolean shouldManifest) throws IOException, SecurityException Constructor.- Parameters:
pattern-append-shouldManifest-- Throws:
IOExceptionSecurityException
-
GenerationFileHandler
public GenerationFileHandler(LinkedList<String> filenameSeries, boolean shouldManifest) throws IOException - Parameters:
filenameSeries-shouldManifest-- Throws:
IOException
-
-
Method Details
-
getFilenameSeries
-
rotate
Move the current file to a new filename with the storeSuffix in place of the activeSuffix; continuing logging to a new file under the original filename.- Parameters:
storeSuffix- Suffix to put in place ofactiveSuffixactiveSuffix- Suffix to replace withstoreSuffix.- Returns:
- GenerationFileHandler instance.
- Throws:
IOException
-
rotate
public GenerationFileHandler rotate(String storeSuffix, String activeSuffix, boolean mergeOld) throws IOException - Throws:
IOException
-
shouldManifest
public boolean shouldManifest()- Returns:
- True if should manifest.
-
makeNew
public static GenerationFileHandler makeNew(String filename, boolean append, boolean shouldManifest) throws SecurityException, IOException Constructor-helper that rather than clobbering any existing file, moves it aside with a timestamp suffix.- Parameters:
filename-append-shouldManifest-- Returns:
- Throws:
SecurityExceptionIOException
-
publish
- Overrides:
publishin classFileHandler
-