Class BaseCloseable
- java.lang.Object
-
- net.sourceforge.pmd.internal.util.BaseCloseable
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public abstract class BaseCloseable extends Object implements Closeable
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
open
-
Constructor Summary
Constructors Constructor Description BaseCloseable()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
close()
Noop if called several times.protected abstract void
doClose()
Called at most once.protected void
ensureOpen()
protected void
ensureOpenIllegalState()
-
-
-
Method Detail
-
ensureOpen
protected final void ensureOpen() throws IOException
- Throws:
IOException
-
ensureOpenIllegalState
protected final void ensureOpenIllegalState() throws IllegalStateException
- Throws:
IllegalStateException
-
close
public void close() throws IOException
Noop if called several times. Thread-safe.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
doClose
protected abstract void doClose() throws IOException
Called at most once.- Throws:
IOException
-
-