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>
TheCleanupTaskdoing 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 noRereadableContenthas 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.RcbStatestateThe state of theRereadableContentBuildercontaining 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 protectedRcbCleanup(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 voidcleanup(boolean explicit)Closes the output stream and deletes the temporary file if noRereadableContenthas 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 theRereadableContentBuildercontaining all mutable fields required for clean-up.
-
-
Method Detail
-
cleanup
public void cleanup(boolean explicit) throws IOExceptionCloses the output stream and deletes the temporary file if noRereadableContenthas been built. This also resets theRereadableContentBuilder.stateappropriately.- 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, anIOExceptionwill be thrown.
-
-