public class FileUtils extends Object
Modifier and Type | Method and Description |
---|---|
static 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(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(String file)
Returns the filename without the extension or '.'.
|
public static String getFileExtension(String file)
file
- the file to get the extension frompublic static String getNameWithoutExtension(String file)
file
- the name of the file remove the extension frompublic static void closeQuietly(InputStream inputStream)
inputStream
- the InputStream to closepublic static void closeQuietly(OutputStream outputStream)
outputStream
- the OutputStream to closepublic static void closeQuietly(Reader reader)
reader
- the Reader to closepublic static void closeQuietly(Writer writer)
writer
- the Writer to closeCopyright © 2011–2018. All rights reserved.