java.io Code Samples
- How do I convert InputStream to String?
- How do I read a text file?
- How do I convert string into InputStream?
- How do I use DataInputStream and DataOutputStream?
- How do I write text file?
- How do I use RandomAccessFile class?
- How do I get a file last modification date?
- How do I store objects in file?
- How do I load properties from XML file?
- How do I use Console class to read user input?
- How do I store properties as XML file?
- How do I get an exception stack trace message?
- How can I get current working directory?
- How do I append data to a text file?
Page of 3 |
Prev
|
Next
How do I get the extension of a file?
Below is an example that can be used to get the extension of a file. The code below assume that the extension is the last part of the file name after the last dot symbol. For instance if you have a file named data.txt the extension will be txt, but if you have a file named 2010.tar.gz the extension will be gz.
