Package org.codehaus.gmavenplus.util
Class FileUtils
- java.lang.Object
-
- org.codehaus.gmavenplus.util.FileUtils
-
public class FileUtils extends java.lang.ObjectA collection of file utility methods taken from Guava so we don't have to depend on Guava.- Since:
- 1.2
-
-
Constructor Summary
Constructors Modifier Constructor Description privateFileUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcloseQuietly(java.io.InputStream inputStream)Closes the InputStream if it is not null, swallowing any exceptions.static voidcloseQuietly(java.io.OutputStream outputStream)Closes the OutputStream if it is not null, swallowing any exceptions.static voidcloseQuietly(java.io.Reader reader)Closes the Reader if it is not null, swallowing any exceptions.static voidcloseQuietly(java.io.Writer writer)Closes the Writer if it is not null, swallowing any exceptions.static java.lang.StringgetFileExtension(java.io.File file)Returns the file extension without the '.' for the given filename, or the empty string if the file has no extension.static java.lang.StringgetFileExtension(java.lang.String file)Returns the file extension without the '.' for the given filename, or the empty string if the file has no extension.static java.lang.StringgetNameWithoutExtension(java.io.File file)Returns the filename without the extension or '.'.static java.lang.StringgetNameWithoutExtension(java.lang.String file)Returns the filename without the extension or '.'.
-
-
-
Method Detail
-
getFileExtension
public static java.lang.String getFileExtension(java.io.File file)
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
public static java.lang.String getFileExtension(java.lang.String file)
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
public static java.lang.String getNameWithoutExtension(java.io.File file)
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
public static java.lang.String getNameWithoutExtension(java.lang.String file)
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
public static void closeQuietly(java.io.InputStream inputStream)
Closes the InputStream if it is not null, swallowing any exceptions.- Parameters:
inputStream- the InputStream to close
-
closeQuietly
public static void closeQuietly(java.io.OutputStream outputStream)
Closes the OutputStream if it is not null, swallowing any exceptions.- Parameters:
outputStream- the OutputStream to close
-
closeQuietly
public static void closeQuietly(java.io.Reader reader)
Closes the Reader if it is not null, swallowing any exceptions.- Parameters:
reader- the Reader to close
-
closeQuietly
public static void closeQuietly(java.io.Writer writer)
Closes the Writer if it is not null, swallowing any exceptions.- Parameters:
writer- the Writer to close
-
-