Closeables that can be closed at once.
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private List |
| Access | Constructor and Description |
|---|---|
| public | |
| public | Closeables(Closeable...
The closeable)Closeables to add.Creates a new |
| Modifier and Type | Method and Description |
|---|---|
| public synchronized boolean | Returns: true iff the closeable was added, false if it was null, already
added before, or if the Closeables instance has been closed already.The closeable. closeable)Adds the given closeable, but only using a weak reference. |
| public synchronized boolean | |
| public void | close()
Implements java. Closes this stream and releases any system resources associated with it. |
| public void | close(IOException
If set, any exceptions thrown in here will be chained to the given
exception via addSuppressed, and then thrown. superException)Closes all registered closeables. |
| public synchronized boolean | |
| public synchronized boolean |
| closed | back to summary |
|---|---|
| private boolean closed | |
| list | back to summary |
|---|---|
| private List<WeakReference<Closeable>> list | |
| Closeables | back to summary |
|---|---|
| public Closeables() Creates a new | |
| Closeables | back to summary |
|---|---|
| public Closeables(Closeable... closeable) Creates a new | |
| add | back to summary |
|---|---|
| public synchronized boolean add(WeakReference<Closeable> closeable) Adds the given closeable, but only using a weak reference.
| |
| add | back to summary |
|---|---|
| public synchronized boolean add(Closeable closeable) Adds the given closeable.
| |
| close | back to summary |
|---|---|
| public void close() throws IOException Implements java. Doc from java. Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect. As noted in
| |
| close | back to summary |
|---|---|
| public void close(IOException superException) throws IOException Closes all registered closeables.
| |
| isClosed | back to summary |
|---|---|
| public synchronized boolean isClosed() Checks if this instance has been closed already.
| |
| remove | back to summary |
|---|---|
| public synchronized boolean remove(Closeable closeable) Removes the given closeable.
| |
| Modifier and Type | Field and Description |
|---|---|
| private final V |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public V |
| strongRef | back to summary |
|---|---|
| private final V strongRef | |
| HardReference | back to summary |
|---|---|
pack-priv HardReference(final V referent)
| |
| get | back to summary |
|---|---|
| public V get() Overrides java. Doc from java. Returns this reference object's referent. If this reference object has
been cleared, either by the program or by the garbage collector, then
this method returns
| |