Package org.jf.util
Class ClassFileNameHandler
java.lang.Object
org.jf.util.ClassFileNameHandler
This class handles the complexities of translating a class name into a file name. i.e. dealing with case insensitive
file systems, windows reserved filenames, class names with extremely long package/class elements, etc.
The types of transformations this class does include:
- append a '#123' style numeric suffix if 2 physical representations collide
- replace some number of characters in the middle with a '#' character name if an individual path element is too long
- append a '#' if an individual path element would otherwise be considered a reserved filename
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classprivate classprivate class -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionClassFileNameHandler(File path, String fileExtension) ClassFileNameHandler(File path, String fileExtension, boolean caseSensitive, boolean modifyWindowsReservedFilenames) -
Method Summary
Modifier and TypeMethodDescriptionprivate static StringaddSuffixBeforeExtension(String pathElement, String suffix) private FileaddUniqueChild(ClassFileNameHandler.DirectoryEntry parent, String[] packageElements, int packageElementIndex) private intgetUniqueFilenameForClass(String className) private static booleanisReservedFileName(String className) private static boolean(package private) static StringshortenPathComponent(String pathComponent, int bytesToRemove) Shortens an individual file/directory name, removing the necessary number of code points from the middle of the string such that the utf-8 encoding of the string is at least bytesToRemove bytes shorter than the original.private static intutf8Length(int codePoint) private static intutf8Length(String str)
-
Field Details
-
MAX_FILENAME_LENGTH
private static final int MAX_FILENAME_LENGTH- See Also:
-
NUMERIC_SUFFIX_RESERVE
private static final int NUMERIC_SUFFIX_RESERVE- See Also:
-
NO_VALUE
private final int NO_VALUE- See Also:
-
CASE_INSENSITIVE
private final int CASE_INSENSITIVE- See Also:
-
CASE_SENSITIVE
private final int CASE_SENSITIVE- See Also:
-
forcedCaseSensitivity
private int forcedCaseSensitivity -
top
-
fileExtension
-
modifyWindowsReservedFilenames
private boolean modifyWindowsReservedFilenames -
reservedFileNameRegex
-
-
Constructor Details
-
ClassFileNameHandler
-
ClassFileNameHandler
-
-
Method Details
-
getMaxFilenameLength
private int getMaxFilenameLength() -
getUniqueFilenameForClass
- Throws:
IOException
-
addUniqueChild
@Nonnull private File addUniqueChild(@Nonnull ClassFileNameHandler.DirectoryEntry parent, @Nonnull String[] packageElements, int packageElementIndex) throws IOException - Throws:
IOException
-
utf8Length
-
utf8Length
private static int utf8Length(int codePoint) -
shortenPathComponent
Shortens an individual file/directory name, removing the necessary number of code points from the middle of the string such that the utf-8 encoding of the string is at least bytesToRemove bytes shorter than the original. The removed codePoints in the middle of the string will be replaced with a # character. -
isWindows
private static boolean isWindows() -
isReservedFileName
-
addSuffixBeforeExtension
-