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 void
closeQuietly
(InputStream inputStream) Closes the InputStream if it is not null, swallowing any exceptions.static void
closeQuietly
(OutputStream outputStream) Closes the OutputStream if it is not null, swallowing any exceptions.static void
closeQuietly
(Reader reader) Closes the Reader if it is not null, swallowing any exceptions.static void
closeQuietly
(Writer writer) Closes the Writer if it is not null, swallowing any exceptions.static String
getFileExtension
(File file) Returns the file extension without the '.' for the given filename, or the empty string if the file has no extension.static String
getFileExtension
(String file) Returns the file extension without the '.' for the given filename, or the empty string if the file has no extension.static String
getNameWithoutExtension
(File file) Returns the filename without the extension or '.'.static String
Returns 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
-