- Apache Commons IO 教程
- Apache Commons IO - 主页
- Apache Commons IO - 概述
- Apache Commons IO - 环境设置
- Apache Commons IO - IOUtils
- Apache Commons IO - FileUtils
- Apache Commons IO - FilenameUtils
- Apache Commons IO - FileSystemUtils
- Apache Commons IO - IOCase
- Apache Commons IO - LineIterator
- Apache Commons IO - NameFileFilter
- Apache Commons IO - WildcardFileFilter
- Apache Commons IO - SuffixFileFilter
- Apache Commons IO - PrefixFileFilter
- Apache Commons IO - OrFileFilter
- Apache Commons IO - AndFileFilter
- Apache Commons IO - FileEntry
- Apache Commons IO - FileAlterationObserver
- Apache Commons IO - FileAlterationMonitor
- Apache Commons IO - NameFileComparator
- Apache Commons IO - SizeFileComparator
- LastModifiedFileComparator
- Apache Commons IO - TeeInputStream
- Apache Commons IO - TeeOutputStream
- Apache Commons IO - 有用资源
- Apache Commons IO - 快速指南
- Apache Commons IO - 有用资源
- Apache Commons IO - 讨论
Apache Commons IO - IOCase
枚举 IO 大小写敏感性。不同的操作系统对文件名的区分大小写规则不同。例如,Windows 对文件命名不区分大小写,而 Unix 则区分大小写。IOCase 捕获了这种差异,提供枚举来控制如何执行文件名比较。它还提供使用枚举执行比较的方法。
枚举声明
以下是 org.apache.commons.io.IOCase 枚举的声明 -
public enum IOCase extends Enum<IOCase> implements Serializable
IOCase 枚举示例
下面提供了 IOCase 枚举的示例 -
IOTester.java
import java.io.IOException; import org.apache.commons.io.IOCase; public class IOTester { public static void main(String[] args) { try { usingIOCase(); } catch(IOException e) { System.out.println(e.getMessage()); } } public static void usingIOCase() throws IOException { String text = "Welcome to TutorialsPoint. Simply Easy Learning."; String text1 = "WELCOME TO TUTORIALSPOINT. SIMPLY EASY LEARNING."; System.out.println("Ends with Learning (case sensitive): " + IOCase.SENSITIVE.checkEndsWith(text1, "Learning.")); System.out.println("Ends with Learning (case insensitive): " + IOCase.INSENSITIVE.checkEndsWith(text1, "Learning.")); System.out.println("Equality Check (case sensitive): " + IOCase.SENSITIVE.checkEquals(text, text1)); System.out.println("Equality Check (case insensitive): " + IOCase.INSENSITIVE.checkEquals(text, text1)); } }
输出
它将打印以下结果 -
Ends with Learning (case sensitive): false Ends with Learning (case insensitive): true Equality Check (case sensitive): false Equality Check (case insensitive): true
广告