Apache Commons IO Tutorial
Selected Reading
- Apache Commons IO - Discussion
- Apache Commons IO - Useful Resources
- Apache Commons IO - Quick Guide
- Apache Commons IO - TeeOutputStream
- Apache Commons IO - TeeInputStream
- LastModifiedFileComparator
- Apache Commons IO - SizeFileComparator
- Apache Commons IO - NameFileComparator
- Apache Commons IO - FileAlterationMonitor
- Apache Commons IO - FileAlterationObserver
- Apache Commons IO - FileEntry
- Apache Commons IO - AndFileFilter
- Apache Commons IO - OrFileFilter
- Apache Commons IO - PrefixFileFilter
- Apache Commons IO - SuffixFileFilter
- Apache Commons IO - WildcardFileFilter
- Apache Commons IO - NameFileFilter
- Apache Commons IO - LineIterator
- Apache Commons IO - IOCase
- Apache Commons IO - FileSystemUtils
- Apache Commons IO - FilenameUtils
- Apache Commons IO - FileUtils
- Apache Commons IO - IOUtils
- Apache Commons IO - Environment Setup
- Apache Commons IO - Overview
- Apache Commons IO - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Apache Commons IO - IOCase
Apache Commons IO - IOCase
Enumeration of IO case sensitivity. Different Operating systems have different rules for case-sensitivity for file names. For example, Windows is case-insensitive for file naming while Unix is case-sensitive. IOCase captures that difference, provides an enumeration to control how filename comparisons should be performed. It also provides methods to use the enumeration to perform comparisons.
Enum Declaration
Following is the declaration for org.apache.commons.io.IOCase Enum −
pubpc enum IOCase extends Enum<IOCase> implements Seriapzable
Example of IOCase Enum
An example of IOCase Enum is given below −
IOTester.java
import java.io.IOException; import org.apache.commons.io.IOCase; pubpc class IOTester { pubpc static void main(String[] args) { try { usingIOCase(); } catch(IOException e) { System.out.println(e.getMessage()); } } pubpc 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("Equapty Check (case sensitive): " + IOCase.SENSITIVE.checkEquals(text, text1)); System.out.println("Equapty Check (case insensitive): " + IOCase.INSENSITIVE.checkEquals(text, text1)); } }
Output
It will print the following result −
Ends with Learning (case sensitive): false Ends with Learning (case insensitive): true Equapty Check (case sensitive): false Equapty Check (case insensitive): trueAdvertisements