public class FileProcessor
extends java.lang.Object
Constructor and Description |
---|
FileProcessor() |
Modifier and Type | Method and Description |
---|---|
boolean |
addFileToBuffer(java.nio.file.Path path)
Adds a file path into buffer for later checking lifetime of file
|
int |
cleanupFiles(int maxCountFiles,
int maxAgeInDays)
This method checks the internal file buffer.
|
void |
copyFile(java.nio.file.Path source,
java.nio.file.Path target)
Copies the given file to the defined target
|
void |
createGzipfile(java.nio.file.Path source,
java.nio.file.Path target)
Crates a GZIP file with the passed target file name and location.
|
void |
createZipfile(java.nio.file.Path source,
java.nio.file.Path target)
Create a zip file from the passed source file at the defined target
location.
|
void |
deleteFile(java.nio.file.Path source)
Deletes the given file
|
java.util.Date |
getDateFromFirstLine(java.nio.file.Path file)
Reads the first line of the given file and tries to extract a Date from
the first 21 characters The expected date format should look like:
'20161213 15:13:09.446'
|
void |
moveFile(java.nio.file.Path source,
java.nio.file.Path target)
Moves the given file to the defined target
|
void |
readExistingFilesInTargetDirectory(java.lang.String targetdir,
java.lang.String targetfilename)
Scans the target directory for files which has no extension or the same extension as the
target file name.
|
public void moveFile(java.nio.file.Path source, java.nio.file.Path target)
public void copyFile(java.nio.file.Path source, java.nio.file.Path target)
public void deleteFile(java.nio.file.Path source)
public void createZipfile(java.nio.file.Path source, java.nio.file.Path target) throws java.io.IOException
java.io.IOException
public void createGzipfile(java.nio.file.Path source, java.nio.file.Path target) throws java.io.IOException
java.io.IOException
public java.util.Date getDateFromFirstLine(java.nio.file.Path file) throws LogarchiverException
LogarchiverException
public boolean addFileToBuffer(java.nio.file.Path path)
public int cleanupFiles(int maxCountFiles, int maxAgeInDays) throws java.io.IOException
java.io.IOException
public void readExistingFilesInTargetDirectory(java.lang.String targetdir, java.lang.String targetfilename)