public final class Closeables
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
close(java.nio.channels.Channel channel,
boolean swallowIOException)
Closes Channel and either propagates or swallows exception depending on specified boolean flag.
|
static void |
close(java.io.Closeable closeable,
boolean swallowIOException)
Closes object implementing closeable by either swallowing or propagating IOException depending on flag parameter.
|
static void |
closeQuietly(java.nio.channels.Channel channel)
Closes Channel quietly.
|
static void |
closeQuietly(java.io.InputStream inputStream)
Closes Input Stream and swallows IOException.
|
static void |
closeQuietly(java.io.OutputStream outputStream)
Closes Output Stream and swallows IOException.
|
static void |
closeQuietly(java.io.Reader reader)
Closes Reader quietly and swallows IOException.
|
public static void close(java.io.Closeable closeable, boolean swallowIOException) throws java.io.IOException
closeable
- the closeableswallowIOException
- the swallow iO exceptionjava.io.IOException
- the iO exceptionpublic static void closeQuietly(java.io.InputStream inputStream)
inputStream
- the input streampublic static void closeQuietly(java.io.OutputStream outputStream)
outputStream
- the output streampublic static void close(java.nio.channels.Channel channel, boolean swallowIOException) throws java.io.IOException
channel
- the channelswallowIOException
- the swallow iO exceptionjava.io.IOException
- the iO exceptionpublic static void closeQuietly(java.nio.channels.Channel channel)
channel
- the channelpublic static void closeQuietly(java.io.Reader reader)
reader
- the reader