| Modifier and Type | Field and Description |
|---|---|
| private static final String | |
| private static final String | |
| private static final int | |
| private static final int[] | ILLEGAL_CHARS
MUST ALWAYS BE A SORTED ARRAY because it is used in a binary search |
| public static final boolean | |
| private static final Logger | |
| public static final int | |
| private static final String | |
| private static final RemoveLatexCommandsFormatter | |
| private static final Pattern |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static Path | Returns: the modified file namethe path to add the extension to path, String the extension to add extension)Adds an extension to the given file name. |
| private static Path | Returns: a windows-style paththe input file path path, int the index driver letter, zero-based indexing letterIndex)Builds a Windows-style path from a Cygwin-style path using a known prefix index. |
| public static Path | Returns: the converted path if running on Windows and path is in Cygwin format; otherwise, returns the original paththe input file path filePath)Converts a Cygwin-style file path to a Windows-style path if the operating system is Windows. |
| public static boolean | |
| public static String | Returns: a suggested dirNamethe database, where the entry is located database, BibEntry the entry to which the directory should be linked to entry, String the dirname pattern directoryNamePattern)Determines directory name provided by an entry in a database |
| public static Optional | Returns: a suggested fileNamethe database, where the entry is located database, BibEntry the entry to which the file should be linked to entry, String the filename pattern fileNamePattern)Determines filename provided by an entry in a database |
| public static boolean | Returns: Boolean whether there is an illegal name.the fileName to detect fileName)Detect illegal characters in given filename. |
| public static Optional | find(@NonNull BibDatabaseContext databaseContext, @NonNull String fileName, @NonNull FilePreferences filePreferences)
|
| public static Optional | |
| public static Optional | Returns: an empty optional if the file does not exist, otherwise, the absolute paththe filename (e.g., a .pdf file), may contain path separators fileName, @NonNull Path the directory which should be search starting point directory)Converts a relative filename to an absolute one, if necessary. |
| public static List | Returns: a list including all found paths to files that match the defined conditionsthe name of the file that should be found filename, List<Path> the directories that will be searched directories)Finds a file inside a list of directory structures. |
| public static Optional | Returns: the path to the first file that matches the defined conditionsthe name of the file that should be found filename, Path the rootDirectory that will be searched rootDirectory)Finds a file inside a directory structure. |
| public static String | |
| public static String | getBaseName(Path fileNameWithExtension)
Returns: the name part of a file name (i.e., everything before last ".") |
| public static Optional | Returns: the extension (without leading dot), trimmed and in lowercase.Returns the extension of a file name or Optional.empty() if the file does not have one (no "." in name). |
| public static Optional | Returns: the extension (without leading dot), trimmed and in lowercaseReturns the extension of a file or Optional.empty() if the file does not have one (no "." in name). |
| public static Optional | Returns: the extracted filename, or Optional.empty if there is none.the URL string to extract the filename from link)Extracts the filename from a URL, which is found between the last slash '/' and first query '?'. |
| public static Optional | getFileSize(@NonNull Path path)
Returns the human-readable size of a file, or an empty optional if it cannot be determined. |
| public static Path | getInitialDirectory(BibDatabaseContext databaseContext, Path workingDirectory)
Returns: Path of current panel database directory or the standard working directory in case the database was not saved yet |
| public static List | |
| public static Optional | Returns: Optional.empty() if the paths are disjointList of paths as Strings paths, Path The to be tested path comparePath)Looks for the shortest unique path of the parent directory in the list of paths |
| public static Optional | Returns: Shortest unique path fragment (if exists) - Optional.empty() if the paths are disjointList of paths as Strings paths, Path The to be shortened path comparePath)Looks for the shortest unique path in the list of paths |
| public static String | |
| public static boolean | |
| public static boolean | |
| public static boolean | |
| public static boolean | |
| public static boolean | Returns: true if file extension is .lnk, false otherwiseThe file to check file)Test if the file is a shortcut file by checking the extension to be ".lnk" (case-insensitive) |
| public static Path | relativize(Path
the file to be shortened file, List<Path> directories to check directories)Converts an absolute file to a relative one, if possible. |
| public static Path | relativize(Path
the file path to be shortened path, BibDatabaseContext databaseContext, FilePreferences filePreferences)Converts an absolute file to a relative one, if possible. |
| public static List | relativize(List<BibEntry> entries, BibDatabaseContext databaseContext, FilePreferences filePreferences)
Relativizes all BibEntries given to (!) the given database context ⚠ Modifies the entries in the list ⚠ |
| public static Path | Returns: The resolved path if file is a .lnk on Windows and the target is a valid file, otherwise returns the original pathThe path to check (may be .lnk or any other file) path)Resolves a Windows shortcut (.lnk) file to its target path. |
| public static String | Returns: the original fileName if fileName.length() <= maxLength. Otherwise, a shortened fileNamethe given file name to be shortened fileName, Integer the maximum number of characters in the string after shortening (including the extension) maxLength)Shorten a given file name in the middle of the name using ellipsis. |
| public static String | toPortableString(Path path)
Creates a string representation of the given path that should work on all systems. |
| private static Optional | |
| public static List | Returns: the minimal unique path substring for each file paththe file paths paths)Creates the minimal unique path substring for each file among multiple file paths. |
| CYGDRIVE_PREFIX | back to summary |
|---|---|
| private static final String CYGDRIVE_PREFIX | |
| ELLIPSIS | back to summary |
|---|---|
| private static final String ELLIPSIS | |
| ELLIPSIS_LENGTH | back to summary |
|---|---|
| private static final int ELLIPSIS_LENGTH | |
| ILLEGAL_CHARS | back to summary |
|---|---|
| private static final int[] ILLEGAL_CHARS MUST ALWAYS BE A SORTED ARRAY because it is used in a binary search | |
| IS_POSIX_COMPLIANT | back to summary |
|---|---|
| public static final boolean IS_POSIX_COMPLIANT | |
| LOGGER | back to summary |
|---|---|
| private static final Logger LOGGER | |
| MAXIMUM_FILE_NAME_LENGTH | back to summary |
|---|---|
| public static final int MAXIMUM_FILE_NAME_LENGTH | |
| MNT_PREFIX | back to summary |
|---|---|
| private static final String MNT_PREFIX | |
| REMOVE_LATEX_COMMANDS_FORMATTER | back to summary |
|---|---|
| private static final RemoveLatexCommandsFormatter REMOVE_LATEX_COMMANDS_FORMATTER | |
| ROOT_DRIVE_PATTERN | back to summary |
|---|---|
| private static final Pattern ROOT_DRIVE_PATTERN | |
| FileUtil | back to summary |
|---|---|
| private FileUtil() | |
| addExtension | back to summary |
|---|---|
| public static Path addExtension(Path path, String extension) Adds an extension to the given file name. The original extension is not replaced. That means, "demo.bib", ".sav" gets "demo.bib.sav" and not "demo.sav" Warning If "ext" is passed, this is literally added. Thus | |
| buildWindowsPathWithDriveLetterIndex | back to summary |
|---|---|
| private static Path buildWindowsPathWithDriveLetterIndex(String path, int letterIndex) Builds a Windows-style path from a Cygwin-style path using a known prefix index. | |
| convertCygwinPathToWindows | back to summary |
|---|---|
| public static Path convertCygwinPathToWindows(String filePath) Converts a Cygwin-style file path to a Windows-style path if the operating system is Windows. Supported formats:
| |
| copyFile | back to summary |
|---|---|
| public static boolean copyFile(Path pathToSourceFile, Path pathToDestinationFile, boolean replaceExisting) Copies a file. | |
| createDirNameFromPattern | back to summary |
|---|---|
| public static String createDirNameFromPattern(BibDatabase database, BibEntry entry, String directoryNamePattern) Determines directory name provided by an entry in a database
| |
| createFileNameFromPattern | back to summary |
|---|---|
| public static Optional Determines filename provided by an entry in a database
| |
| detectBadFileName | back to summary |
|---|---|
| public static boolean detectBadFileName(String fileName) Detect illegal characters in given filename.
| |
| find | back to summary |
|---|---|
| public static Optional | |
| find | back to summary |
|---|---|
| public static Optional Converts a relative filename to an absolute one, if necessary. Returns an empty optional if the file does not exist. Will look in each of the given directories starting from the beginning and returning the first found file to match if any. | |
| find | back to summary |
|---|---|
| public static Optional Converts a relative filename to an absolute one, if necessary. | |
| findListOfFiles | back to summary |
|---|---|
| public static List Finds a file inside a list of directory structures. Will also look for the file inside nested directories. | |
| findSingleFileRecursively | back to summary |
|---|---|
| public static Optional Finds a file inside a directory structure. Will also look for the file inside nested directories. | |
| getBaseName | back to summary |
|---|---|
| public static String getBaseName(String fileName) Returns the name part of a file name. Typically, this is everything before last ".". Exception: if only a single dot is contained and nothing is before the last dot - all is returned
| |
| getBaseName | back to summary |
|---|---|
public static String getBaseName(Path fileNameWithExtension)
| |
| getFileExtension | back to summary |
|---|---|
| public static Optional Returns the extension of a file name or Optional.empty() if the file does not have one (no "." in name). In case the filename starts with a "." and only has one ".", the part after the dot is NOT the extension | |
| getFileExtension | back to summary |
|---|---|
| public static Optional Returns the extension of a file or Optional.empty() if the file does not have one (no "." in name). | |
| getFileNameFromUrl | back to summary |
|---|---|
| public static Optional Extracts the filename from a URL, which is found between the last slash '/' and first query '?'. Does not check that the file is a valid URL. | |
| getFileSize | back to summary |
|---|---|
| public static Optional Returns the human-readable size of a file, or an empty optional if it cannot be determined. | |
| getInitialDirectory | back to summary |
|---|---|
public static Path getInitialDirectory(BibDatabaseContext databaseContext, Path workingDirectory)
| |
| getListOfLinkedFiles | back to summary |
|---|---|
| public static List Returns the list of linked files. The files have the absolute filename | |
| getUniquePathDirectory | back to summary |
|---|---|
| public static Optional Looks for the shortest unique path of the parent directory in the list of paths | |
| getUniquePathFragment | back to summary |
|---|---|
| public static Optional Looks for the shortest unique path in the list of paths | |
| getValidFileName | back to summary |
|---|---|
| public static String getValidFileName(String fileName) Returns a valid filename for most operating systems. It uses For "real" cleaning, | |
| isBibFile | back to summary |
|---|---|
| public static boolean isBibFile(Path file) Test if the file is a bib file by simply checking the extension to be ".bib" (case-insensitive)
| |
| isCharLegal | back to summary |
|---|---|
| public static boolean isCharLegal(char c) | |
| isImage | back to summary |
|---|---|
| public static boolean isImage(Path file) Test if the file is an image file by simply checking if its extension is an image extension
| |
| isPDFFile | back to summary |
|---|---|
| public static boolean isPDFFile(Path file) Test if the file is a pdf file by simply checking the extension to be ".pdf" (case-insensitive)
| |
| isShortcutFile | back to summary |
|---|---|
| public static boolean isShortcutFile(Path file) Test if the file is a shortcut file by checking the extension to be ".lnk" (case-insensitive)
| |
| relativize | back to summary |
|---|---|
| public static Path relativize(Path file, List<Path> directories) Converts an absolute file to a relative one, if possible. Returns the parameter file itself if no shortening is possible. This method works correctly only if directories are sorted decent in their length i.e. /home/user/literature/important before /home/user/literature. | |
| relativize | back to summary |
|---|---|
| public static Path relativize(Path path, BibDatabaseContext databaseContext, FilePreferences filePreferences) Converts an absolute file to a relative one, if possible. Returns the parameter file itself if no shortening is possible.
| |
| relativize | back to summary |
|---|---|
| public static List Relativizes all BibEntries given to (!) the given database context ⚠ Modifies the entries in the list ⚠ | |
| resolveIfShortcut | back to summary |
|---|---|
| public static Path resolveIfShortcut(Path path) Resolves a Windows shortcut (.lnk) file to its target path. Uses the mslinks library which is already a project dependency. Only works on Windows systems. On other systems or if resolution fails, returns the original path. | |
| shortenFileName | back to summary |
|---|---|
| public static String shortenFileName(String fileName, Integer maxLength) Shorten a given file name in the middle of the name using ellipsis. Example: verylongfilenameisthis.pdf with maxLength = 20 is shortened into verylo...isthis.pdf | |
| toPortableString | back to summary |
|---|---|
| public static String toPortableString(Path path) Creates a string representation of the given path that should work on all systems. This method should be used when a path needs to be stored in the bib file or preferences. | |
| toRealPath | back to summary |
|---|---|
| private static Optional | |
| uniquePathSubstrings | back to summary |
|---|---|
| public static List Creates the minimal unique path substring for each file among multiple file paths. | |