public final class IOUtils extends Object
Modifier and Type | Field and Description |
---|---|
static Charset |
UTF8
Represents the UTF-8 character set.
|
Modifier and Type | Method and Description |
---|---|
static void |
closeIfCloseable(Object closeable)
Close the given
closeable if it implements the Closeable interface. |
static void |
closeQuietly(Closeable closeable)
Closes any Closable object, while suppressing any IOExceptions it will generate.
|
static void |
closeQuietlyIfCloseable(Object closeable)
Closes any object if that object implements
Closeable , while suppressing any IOExceptions it will
generate. |
public static final Charset UTF8
public static void closeQuietly(Closeable closeable)
closeable
may be null
, in which case nothing happens.closeable
- the object to be closedpublic static void closeQuietlyIfCloseable(Object closeable)
Closeable
, while suppressing any IOExceptions it will
generate. The given closeable
may be null
, in which case nothing happens.closeable
- the object to be closedpublic static void closeIfCloseable(Object closeable) throws IOException
closeable
if it implements the Closeable
interface. Otherwise, nothing
happens. Unlike closeQuietlyIfCloseable(Object)
, this method does not suppress any exceptions thrown
while attempting to close the resource.closeable
- The object to closeIOException
- when an error occurs while closing the resourceCopyright © 2010-2014. All Rights Reserved.