public final class Closer extends Object
I considered a template method approach, but that's equally ugly.
The methods are intended to be called from finally blocks, and so handle all
exceptions quietly; with the exception of InterruptedExceptions
which are always converted to UncheckedInterruptedExceptions.
| Modifier and Type | Method and Description |
|---|---|
static void |
close(InputStream inputStream)
Close the resource.
|
static void |
close(OutputStream outputStream)
Close the resource.
|
static void |
close(Reader reader)
Close the resource.
|
static void |
close(Socket socket)
Close the resource.
|
static void |
close(Writer writer)
Close the resource.
|
public static void close(Reader reader)
reader - The resource to close.public static void close(Writer writer)
writer - The resource to close.public static void close(InputStream inputStream)
inputStream - The resource to close.public static void close(OutputStream outputStream)
outputStream - The resource to close.public static void close(Socket socket)
socket - The resource to close.Copyright © 2000-2014. All Rights Reserved.