Different filing systems have different rules for case-sensitivity. Windows is case-insensitive, Unix is case-sensitive.
This class captures that difference, providing an enumeration to control how filename comparisons should be performed. It also provides methods that use the enumeration to perform comparisons.
Wherever possible, you should use the check methods in this
class to compare filenames.
| Modifier and Type | Field and Description |
|---|---|
| public static final IOCase | INSENSITIVE
The constant for case insensitive regardless of operating system. |
| private final String | name
The enumeration name. |
| public static final IOCase | SENSITIVE
The constant for case sensitive regardless of operating system. |
| private final transient boolean | sensitive
The sensitivity flag. |
| private static final long | serialVersionUID
Serialization version. |
| public static final IOCase | SYSTEM
The constant for case sensitivity determined by the current operating system. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | Returns: true if equal using the case rulesthe string to check, not null str, String the end to compare against, not null end)Checks if one string ends with another using the case-sensitivity rule. |
| public boolean | Returns: true if equal using the case rulesthe first string to compare, not null str1, String the second string to compare, not null str2)Compares two strings using the case-sensitivity rule. |
| public boolean | Returns: true if equal using the case rulesthe string to check, not null str, int the index to start at in str strStartIndex, String the start to search for, not null search)Checks if one string contains another at a specific index using the case-sensitivity rule. |
| public boolean | Returns: true if equal using the case rulesthe string to check, not null str, String the start to compare against, not null start)Checks if one string starts with another using the case-sensitivity rule. |
| pack-priv String | Returns: the lower-case version if case-insensitivethe string to convert, null returns null str)Converts the case of the input String to a standard format. |
| public static IOCase | |
| public String | |
| public boolean | Returns: true if case sensitiveDoes the object represent case sensitive comparison. |
| private Object | |
| public String | Returns: a string describing the sensitivityOverrides java. |
| INSENSITIVE | back to summary |
|---|---|
| public static final IOCase INSENSITIVE The constant for case insensitive regardless of operating system. | |
| name | back to summary |
|---|---|
| private final String name The enumeration name. | |
| SENSITIVE | back to summary |
|---|---|
| public static final IOCase SENSITIVE The constant for case sensitive regardless of operating system. | |
| sensitive | back to summary |
|---|---|
| private final transient boolean sensitive The sensitivity flag. | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Serialization version. | |
| SYSTEM | back to summary |
|---|---|
| public static final IOCase SYSTEM The constant for case sensitivity determined by the current operating system. Windows is case-insensitive when comparing filenames, Unix is case-sensitive. If you derialize this constant of Windows, and deserialize on Unix, or vice versa, then the value of the case-sensitivity flag will change. | |
| IOCase | back to summary |
|---|---|
| private IOCase(String name, boolean sensitive) Private constructor.
| |
| checkEndsWith | back to summary |
|---|---|
| public boolean checkEndsWith(String str, String end) Checks if one string ends with another using the case-sensitivity rule.
This method mimics
| |
| checkEquals | back to summary |
|---|---|
| public boolean checkEquals(String str1, String str2) Compares two strings using the case-sensitivity rule.
This method mimics
| |
| checkRegionMatches | back to summary |
|---|---|
| public boolean checkRegionMatches(String str, int strStartIndex, String search) Checks if one string contains another at a specific index using the case-sensitivity rule.
This method mimics parts of
| |
| checkStartsWith | back to summary |
|---|---|
| public boolean checkStartsWith(String str, String start) Checks if one string starts with another using the case-sensitivity rule.
This method mimics
| |
| convertCase | back to summary |
|---|---|
| pack-priv String convertCase(String str) Converts the case of the input String to a standard format. Subsequent operations can then use standard String methods. | |
| forName | back to summary |
|---|---|
| public static IOCase forName(String name) Factory method to create an IOCase from a name.
| |
| getName | back to summary |
|---|---|
| public String getName() Gets the name of the constant.
| |
| isCaseSensitive | back to summary |
|---|---|
| public boolean isCaseSensitive() Does the object represent case sensitive comparison.
| |
| readResolve | back to summary |
|---|---|
| private Object readResolve() Replaces the enumeration from the stream with a real one. This ensures that the correct flag is set for SYSTEM.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Gets a string describing the sensitivity.
| |