Package de.aristaflow.adept2.util.io
Class RereadableContentBuilder.RcbCleanup
- java.lang.Object
-
- de.aristaflow.adept2.util.CleanupTask.AbstractCleanupTask<IOException>
-
- de.aristaflow.adept2.util.io.RereadableContentBuilder.RcbCleanup
-
- All Implemented Interfaces:
CleanupTask<IOException>
- Enclosing class:
- RereadableContentBuilder
protected static final class RereadableContentBuilder.RcbCleanup extends CleanupTask.AbstractCleanupTask<IOException>
TheCleanupTask
doing the clean-up (RereadableContentBuilder.close()
) independently from theRereadableContentBuilder
. This allows to use it as post-mortem action of theRereadableContentBuilder
.
This will close the output if not done yet and delete the temporary file if present and noRereadableContent
has been built.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface de.aristaflow.adept2.util.CleanupTask
CleanupTask.AbstractCleanupTask<EX extends Exception>, CleanupTask.AtomicCloseTask, CleanupTask.CloseAndResetTask, CleanupTask.MutableCloseTask
-
-
Field Summary
Fields Modifier and Type Field Description protected de.aristaflow.adept2.util.io.RereadableContentBuilder.RcbState
state
The state of theRereadableContentBuilder
containing all mutable fields required for clean-up.-
Fields inherited from class de.aristaflow.adept2.util.CleanupTask.AbstractCleanupTask
descriptor, logger
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
RcbCleanup(de.aristaflow.adept2.util.io.RereadableContentBuilder.RcbState state)
Creates a new clean-up for closing as post-mortem action of aRereadableContentBuilder
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cleanup(boolean explicit)
Closes the output stream and deletes the temporary file if noRereadableContent
has been built.-
Methods inherited from class de.aristaflow.adept2.util.CleanupTask.AbstractCleanupTask
getDescriptor
-
-
-
-
Constructor Detail
-
RcbCleanup
protected RcbCleanup(de.aristaflow.adept2.util.io.RereadableContentBuilder.RcbState state)
Creates a new clean-up for closing as post-mortem action of aRereadableContentBuilder
. Also used for RereadableContentBuilder.close() explicit clean-up.- Parameters:
state
- The state of theRereadableContentBuilder
containing all mutable fields required for clean-up.
-
-
Method Detail
-
cleanup
public void cleanup(boolean explicit) throws IOException
Closes the output stream and deletes the temporary file if noRereadableContent
has been built. This also resets theRereadableContentBuilder.state
appropriately.- Parameters:
explicit
- Whether the clean-up was triggered explicitly viaCleanup.clean()
. Otherwise it was triggered implicitly as a post-mortem action by the object becoming phantom reachable.- Throws:
IOException
- If closing or deleting fails, anIOException
will be thrown.
-
-