T
- the type of the wrapped resourcepublic abstract class CloseableResource<T> extends Object implements Closeable
CloseableResource<T>
is a wrapper around a resource of type T
which must do
some sort of cleanup when it is no longer in use.Constructor and Description |
---|
CloseableResource(T resource)
Creates a
CloseableResource wrapper around the given resource. |
Modifier and Type | Method and Description |
---|---|
abstract void |
close()
Performs any cleanup operations necessary when the resource is no longer in use.
|
T |
get() |
public CloseableResource(T resource)
CloseableResource
wrapper around the given resource. This resource will
be returned by the get()
method.resource
- the resource to wrappublic T get()
public abstract void close()
close
in interface Closeable
close
in interface AutoCloseable
Copyright © 2023. All Rights Reserved.