Package org.codehaus.gmavenplus.util
Class FileUtils
java.lang.Object
org.codehaus.gmavenplus.util.FileUtils
A collection of file utility methods taken from Guava so we don't have to depend on Guava.
- Since:
- 1.2
- Author:
- Keegan Witt
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidcloseQuietly(InputStream inputStream) Closes the InputStream if it is not null, swallowing any exceptions.static voidcloseQuietly(OutputStream outputStream) Closes the OutputStream if it is not null, swallowing any exceptions.static voidcloseQuietly(Reader reader) Closes the Reader if it is not null, swallowing any exceptions.static voidcloseQuietly(Writer writer) Closes the Writer if it is not null, swallowing any exceptions.static StringgetFileExtension(File file) Returns the file extension without the '.' for the given filename, or the empty string if the file has no extension.static StringgetFileExtension(String file) Returns the file extension without the '.' for the given filename, or the empty string if the file has no extension.static StringgetNameWithoutExtension(File file) Returns the filename without the extension or '.'.static StringReturns the filename without the extension or '.'.
-
Method Details
-
getFileExtension
Returns the file extension without the '.' for the given filename, or the empty string if the file has no extension.- Parameters:
file- the file to get the extension from- Returns:
- the file extension
-
getFileExtension
Returns the file extension without the '.' for the given filename, or the empty string if the file has no extension.- Parameters:
file- the file to get the extension from- Returns:
- the file extension
-
getNameWithoutExtension
Returns the filename without the extension or '.'.- Parameters:
file- the file remove the extension from- Returns:
- the file name without its path or extension
-
getNameWithoutExtension
Returns the filename without the extension or '.'.- Parameters:
file- the file remove the extension from- Returns:
- the file name without its path or extension
-
closeQuietly
Closes the InputStream if it is not null, swallowing any exceptions.- Parameters:
inputStream- the InputStream to close
-
closeQuietly
Closes the OutputStream if it is not null, swallowing any exceptions.- Parameters:
outputStream- the OutputStream to close
-
closeQuietly
Closes the Reader if it is not null, swallowing any exceptions.- Parameters:
reader- the Reader to close
-
closeQuietly
Closes the Writer if it is not null, swallowing any exceptions.- Parameters:
writer- the Writer to close
-