Package de.intarsys.tools.file
Class AttachmentTools
java.lang.Object
de.intarsys.tools.file.AttachmentTools
Utility methods to handle attachment relationships between files.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static StringcreateAttachmentName(String masterName, String movedName, String attachName) static ListcreateAttachments(File master, File[] files, String extensions) Create a list ofFileinstances selected from the array of candidates that are recognized as attachments tofile.static ListcreateAttachments(File master, String extensions) Find all attachments tomaster.static voiddeleteAttachments(List attachments) static FilemoveAttachment(File master, File attachment, File movedFile, boolean delete) protected static FilemoveAttachment(String masterName, Object attachment, String movedName, File dir, boolean delete) static ListmoveAttachments(File master, List attachments, File movedFile, boolean delete)
-
Constructor Details
-
AttachmentTools
public AttachmentTools()
-
-
Method Details
-
createAttachmentName
-
createAttachments
Create a list ofFileinstances selected from the array of candidates that are recognized as attachments tofile.The attachments are selected using a ";" separated list of suffixes (including the ".").
A file is accepted as an attachment if it has an attachment suffix and the file base name is either the same as the target filename or target file base name.
foo.bar foo.bar.suffix (accepted) foo.suffix (accepted) foo.txt (rejected)All checks are case insensitive.
- Parameters:
master-files-extensions-- Returns:
- a list of
Fileinstances selected from the array of candidates that are recognized as attachments tofile.
-
createAttachments
Find all attachments tomaster. Attachments are defined to be all files in the same directory asmasterthat satisfy one of theextensions.- Parameters:
master-extensions-- Returns:
- all attachments to
master
-
deleteAttachments
-
moveAttachment
-
moveAttachment
protected static File moveAttachment(String masterName, Object attachment, String movedName, File dir, boolean delete) throws IOException - Throws:
IOException
-
moveAttachments
-