public class FileAttachmentTools extends Object
| Constructor and Description |
|---|
FileAttachmentTools() |
| Modifier and Type | Method and Description |
|---|---|
static List |
createAttachments(File master,
File[] files,
String extensions)
Create a list of
File instances selected from the array of
candidates that are recognized as attachments to master. |
static List |
createAttachments(File master,
String extensions)
Find all attachments to
master. |
static void |
deleteAttachments(List attachments) |
static boolean |
existsAttachments(File master,
File[] files,
String extensions)
true if all required attachments for master are available.
|
static boolean |
isAttachment(File file,
String extensions)
true, if file is an attachment as defined in the extensions. extensions
is a ";" separated list of extensions in the form ".ext".
|
static File |
moveAttachment(File master,
File attachment,
File movedFile,
boolean delete) |
static File |
moveAttachment(File master,
File attachment,
File movedFile,
boolean delete,
boolean keepLastModified)
Given the original master file and an attachment to this file, move the
attachments to the correct location for the new master file location
given in movedFile.
|
static List |
moveAttachments(File master,
List attachments,
File movedFile,
boolean delete) |
static List |
moveAttachments(File master,
List attachments,
File movedFile,
boolean delete,
boolean keepLastModified)
Given the original master file and the list of attachments to this file,
move all attachments to the correct location for the new master file
location given in movedFile.
|
public static List createAttachments(File master, File[] files, String extensions)
File instances selected from the array of
candidates that are recognized as attachments to master.
The attachments are selected using a ";" separated list of suffixes (including the ".", like in ".ext").
A file is accepted as an attachment if it has an attachment suffix and
the file base name is either the same as the master file name or master
file base name. The master may be null to accept all attachments in a
directory
foo.bar
foo.bar.suffix (accepted)
foo.suffix (accepted)
foo.txt (rejected)
All checks are case insensitive.
master - files - extensions - File instances selected from the array of
candidates that are recognized as attachments to
master.public static List createAttachments(File master, String extensions)
master. Attachments are defined to
be all files in the same directory as master that satisfy
one of the extensions.master - extensions - masterpublic static void deleteAttachments(List attachments)
public static boolean existsAttachments(File master, File[] files, String extensions)
master - files - extensions - public static boolean isAttachment(File file, String extensions)
file - extensions - public static File moveAttachment(File master, File attachment, File movedFile, boolean delete) throws IOException
IOExceptionpublic static File moveAttachment(File master, File attachment, File movedFile, boolean delete, boolean keepLastModified) throws IOException
If delete is true, old attachment files are deleted.
master - attachment - movedFile - delete - keepLastModified - IOExceptionpublic static List moveAttachments(File master, List attachments, File movedFile, boolean delete) throws IOException
IOExceptionpublic static List moveAttachments(File master, List attachments, File movedFile, boolean delete, boolean keepLastModified) throws IOException
If delete is true, old attachment files are deleted.
master - attachments - movedFile - delete - IOExceptionCopyright © 2013 intarsys consulting GmbH. All Rights Reserved.