Package org.frankframework.filesystem
Class FileSystemUtils
java.lang.Object
org.frankframework.filesystem.FileSystemUtils
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <F> void
checkSource
(IBasicFileSystem<F> fileSystem, F source, FileSystemActor.FileSystemAction action) Check if a source file exists.static <F> F
copyFile
(IBasicFileSystem<F> fileSystem, F file, String destinationFolder, boolean overwrite, int numOfBackups, boolean createFolders, boolean destinationMustBeReturned) static <F> MessageContext
getContext
(IBasicFileSystem<F> fileSystem, F file) static <F> MessageContext
getContext
(IBasicFileSystem<F> fileSystem, F file, String charset) static <F> DirectoryStream
<F> getDirectoryStream
(Iterable<F> iterable) static <F> DirectoryStream
<F> getDirectoryStream
(Iterator<F> iterator) static <F> DirectoryStream
<F> getDirectoryStream
(Iterator<F> iterator, Runnable onClose) static <F> DirectoryStream
<F> getDirectoryStream
(Iterator<F> iterator, Supplier<IOException> onClose) static <F,
FS extends IBasicFileSystem<F>>
StringgetFileInfo
(FS fileSystem, F f, DocumentFormat format) static <F,
FS extends IBasicFileSystem<F>>
voidgetFileInfo
(FS fileSystem, F f, INodeBuilder nodeBuilder) static <F> Stream
<F> getFilteredStream
(IBasicFileSystem<F> fileSystem, String folder, String wildCard, String excludeWildCard, TypeFilter typeFilter) static <F> F
moveFile
(IBasicFileSystem<F> fileSystem, F file, String destinationFolder, boolean overwrite, int numOfBackups, boolean createFolders, boolean destinationMustBeReturned) static <F> void
prepareDestination
(IBasicFileSystem<F> fileSystem, F source, String destinationFolder, boolean overwrite, int numOfBackups, boolean createFolders, FileSystemActor.FileSystemAction action) Prepares the destination folder, e.g. for move or copy.static <F> void
prepareDestination
(IWritableFileSystem<F> fileSystem, F destination, boolean overwrite, int numOfBackups, FileSystemActor.FileSystemAction action) Prepares the destination of a file: - if the file exists, checks overwrite, or performs rolloverstatic <F> F
renameFile
(IWritableFileSystem<F> fileSystem, F source, F destination, boolean overwrite, int numOfBackups) static <F> void
rolloverByDay
(IWritableFileSystem<F> fileSystem, F file, String folder, int rotateDays) static <F> void
rolloverByNumber
(IWritableFileSystem<F> fileSystem, F file, int numberOfBackups) static <F> void
rolloverBySize
(IWritableFileSystem<F> fileSystem, F file, int rotateSize, int numberOfBackups)
-
Field Details
-
log
protected static org.apache.logging.log4j.Logger log
-
-
Constructor Details
-
FileSystemUtils
public FileSystemUtils()
-
-
Method Details
-
checkSource
public static <F> void checkSource(IBasicFileSystem<F> fileSystem, F source, FileSystemActor.FileSystemAction action) throws FileSystemException Check if a source file exists.- Throws:
FileSystemException
-
prepareDestination
public static <F> void prepareDestination(IWritableFileSystem<F> fileSystem, F destination, boolean overwrite, int numOfBackups, FileSystemActor.FileSystemAction action) throws FileSystemException Prepares the destination of a file: - if the file exists, checks overwrite, or performs rollover- Throws:
FileSystemException
-
prepareDestination
public static <F> void prepareDestination(IBasicFileSystem<F> fileSystem, F source, String destinationFolder, boolean overwrite, int numOfBackups, boolean createFolders, FileSystemActor.FileSystemAction action) throws FileSystemException Prepares the destination folder, e.g. for move or copy.- Throws:
FileSystemException
-
renameFile
public static <F> F renameFile(IWritableFileSystem<F> fileSystem, F source, F destination, boolean overwrite, int numOfBackups) throws FileSystemException - Throws:
FileSystemException
-
moveFile
public static <F> F moveFile(IBasicFileSystem<F> fileSystem, F file, String destinationFolder, boolean overwrite, int numOfBackups, boolean createFolders, boolean destinationMustBeReturned) throws FileSystemException - Throws:
FileSystemException
-
copyFile
public static <F> F copyFile(IBasicFileSystem<F> fileSystem, F file, String destinationFolder, boolean overwrite, int numOfBackups, boolean createFolders, boolean destinationMustBeReturned) throws FileSystemException - Throws:
FileSystemException
-
getContext
public static <F> MessageContext getContext(IBasicFileSystem<F> fileSystem, F file) throws FileSystemException - Throws:
FileSystemException
-
getContext
public static <F> MessageContext getContext(IBasicFileSystem<F> fileSystem, F file, String charset) throws FileSystemException - Throws:
FileSystemException
-
rolloverByNumber
public static <F> void rolloverByNumber(IWritableFileSystem<F> fileSystem, F file, int numberOfBackups) throws FileSystemException - Throws:
FileSystemException
-
rolloverBySize
public static <F> void rolloverBySize(IWritableFileSystem<F> fileSystem, F file, int rotateSize, int numberOfBackups) throws FileSystemException - Throws:
FileSystemException
-
getDirectoryStream
-
getDirectoryStream
-
getDirectoryStream
-
getDirectoryStream
public static <F> DirectoryStream<F> getDirectoryStream(Iterator<F> iterator, Supplier<IOException> onClose) -
rolloverByDay
public static <F> void rolloverByDay(IWritableFileSystem<F> fileSystem, F file, String folder, int rotateDays) throws FileSystemException - Throws:
FileSystemException
-
getFilteredStream
@Nonnull public static <F> Stream<F> getFilteredStream(IBasicFileSystem<F> fileSystem, String folder, String wildCard, String excludeWildCard, @Nonnull TypeFilter typeFilter) throws FileSystemException - Throws:
FileSystemException
-
getFileInfo
public static <F,FS extends IBasicFileSystem<F>> String getFileInfo(FS fileSystem, F f, DocumentFormat format) throws FileSystemException - Throws:
FileSystemException
-
getFileInfo
public static <F,FS extends IBasicFileSystem<F>> void getFileInfo(FS fileSystem, F f, INodeBuilder nodeBuilder) throws FileSystemException, SAXException - Throws:
FileSystemException
SAXException
-