Package com.globalmentor.io
Class AbstractCloseable
java.lang.Object
com.globalmentor.io.AbstractCloseable
- All Implemented Interfaces:
Closeable
,AutoCloseable
Abstract base implementation to facilitate implementation of
Closeable
.
This implementation ensures that Closeable.close()
is idempotent by preventing the underlying close implementation from being called more than once.
Implementations must override closeImpl()
.
- Author:
- Garret Wilson
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Implementations must overridecloseImpl()
.protected abstract void
Implements the closing functionality.
-
Constructor Details
-
AbstractCloseable
public AbstractCloseable()
-
-
Method Details
-
close
Implementations must overridecloseImpl()
.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
- See Also:
-
closeImpl
Implements the closing functionality.- Throws:
IOException
- if an I/O error occurs.- See Also:
-