Constructor and Description |
---|
SafeCloser()
Creates a new empty instance.
|
SafeCloser(T value)
Creates a new instance with target
Closeable . |
Modifier and Type | Method and Description |
---|---|
void |
close() |
T |
get()
Returns the target object.
|
protected void |
handle(IOException exception)
Handles an exception while closing the target object.
|
void |
set(T newValue)
Sets the target object.
|
public T get()
IllegalStateException
- if no objects were setpublic void set(T newValue)
newValue
- the target objectIllegalStateException
- if the target object was already setpublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
protected void handle(IOException exception) throws IOException
exception
- the occurred exceptionIOException
- if the exception was re-thrownCopyright © 2011–2019 Asakusa Framework Team. All rights reserved.