| Modifier and Type | Field and Description |
|---|---|
| private static final Pattern | |
| private static final Logger |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static String | Returns: Suggested name for the file without extensionSuffix and duplicate marks such as " (1)"Suggested name for the file without extensionSuffix, if it has duplicate file name with other file, it will end with something like " (1)" fileName)This is the opposite function of getNonOverWritingFileName It will recover the file name to origin if it has duplicate mark such as " (1)" change the String whose format is "xxxxxx (number)" into "xxxxxx", while return the same String when it does not match the format This is the opposite function of getNonOverWritingFileName |
| public static Path | |
| public static String | generateUniqueFileName(Path targetDirectory, String
The proposed name for the file without any patchers for "(1)" etc. proposedName)Generates a unique filename in the target directory while taking into account existing files that may be already linked to the same bibliography entry. |
| public static String | Returns: a file name such that it does not match any existing files in targetDirectoryThe directory in which filename should be unique targetDirectory, String Suggested name for the file fileName)Returns a file name such that it does not match any existing files in targetDirectory |
| public static boolean | Returns: true when the content of the newly downloaded file is same as the file with "similar" name, false when there is no "similar" file name or the content is different from that of files with "similar" nameThe directory which saves the files (.pdf, for example) directory, @NonNull Path Suggest name for the newly downloaded file fileName, @NonNull Consumer<String> To display the error and success message messageOnDeletion)This function decide whether the newly downloaded file has the same content with other files It returns ture when the content is duplicate, while returns false if it is not |
| DUPLICATE_MARK_PATTERN | back to summary |
|---|---|
| private static final Pattern DUPLICATE_MARK_PATTERN | |
| LOGGER | back to summary |
|---|---|
| private static final Logger LOGGER | |
| FileNameUniqueness | back to summary |
|---|---|
| public FileNameUniqueness() | |
| eraseDuplicateMarks | back to summary |
|---|---|
| public static String eraseDuplicateMarks(String fileName) This is the opposite function of getNonOverWritingFileName It will recover the file name to origin if it has duplicate mark such as " (1)" change the String whose format is "xxxxxx (number)" into "xxxxxx", while return the same String when it does not match the format This is the opposite function of getNonOverWritingFileName | |
| eraseDuplicateMarks | back to summary |
|---|---|
| public static Path eraseDuplicateMarks(Path filePath) | |
| generateUniqueFileName | back to summary |
|---|---|
| public static String generateUniqueFileName(Path targetDirectory, String proposedName) Generates a unique filename in the target directory while taking into account existing files that may be already linked to the same bibliography entry.
| |
| getNonOverWritingFileName | back to summary |
|---|---|
| public static String getNonOverWritingFileName(Path targetDirectory, String fileName) Returns a file name such that it does not match any existing files in targetDirectory | |
| isDuplicatedFile | back to summary |
|---|---|
| public static boolean isDuplicatedFile(@NonNull Path directory, @NonNull Path fileName, @NonNull Consumer<String> messageOnDeletion) throws IOException This function decide whether the newly downloaded file has the same content with other files It returns ture when the content is duplicate, while returns false if it is not
| |