Class OperatorFileWriter.Result
java.lang.Object
com.ultikits.ultitools.config.document.OperatorFileWriter.Result
- Enclosing class:
OperatorFileWriter
The outcome of one write, its one-phrase reason, and the document now on disk when there is one.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ConfigDocumentprivate final Stringprivate final OperatorFileWriter.Outcomeprivate final Stringprivate final String -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateResult(OperatorFileWriter.Outcome outcome, String reason, ConfigDocument document) privateResult(OperatorFileWriter.Outcome outcome, String reason, ConfigDocument document, String fingerprint, String readFingerprint) -
Method Summary
Modifier and TypeMethodDescriptionbooleanapplied()Whether the file now holds the edited document.document()The edited document, which is what the file now holds, forOperatorFileWriter.Outcome.WRITTENandOperatorFileWriter.Outcome.UNCHANGED;nullotherwise.The SHA-256 (lower-case hex, asConfigLoadResult.fingerprint()) of the bytes the gate wrote, or of the bytes it read when nothing needed writing;nullwhen it did not apply the edit.outcome()What happened.The SHA-256 (lower-case hex, orOperatorFileWriter.ABSENT) of the bytes the gate read and verified the edit against - forOperatorFileWriter.Outcome.WRITTEN, the bytes the file held immediately before it was replaced;nullwhen it did not apply the edit.reason()Why nothing was written, as a phrase without any value; empty when written or unchanged.
-
Field Details
-
outcome
-
reason
-
document
-
fingerprint
-
readFingerprint
-
-
Constructor Details
-
Result
-
Result
private Result(OperatorFileWriter.Outcome outcome, String reason, ConfigDocument document, String fingerprint, String readFingerprint)
-
-
Method Details
-
outcome
What happened.- Returns:
- the outcome
-
reason
Why nothing was written, as a phrase without any value; empty when written or unchanged.- Returns:
- the reason
-
document
The edited document, which is what the file now holds, forOperatorFileWriter.Outcome.WRITTENandOperatorFileWriter.Outcome.UNCHANGED;nullotherwise.- Returns:
- the document or
null
-
fingerprint
The SHA-256 (lower-case hex, asConfigLoadResult.fingerprint()) of the bytes the gate wrote, or of the bytes it read when nothing needed writing;nullwhen it did not apply the edit. A caller records this, never a fresh read of the file, as the bytes it last saw, so an edit made after them stays visible.- Returns:
- the fingerprint or
null
-
readFingerprint
The SHA-256 (lower-case hex, orOperatorFileWriter.ABSENT) of the bytes the gate read and verified the edit against - forOperatorFileWriter.Outcome.WRITTEN, the bytes the file held immediately before it was replaced;nullwhen it did not apply the edit. A caller that compares this with the bytes it last bound can tell whether the file it wrote still held only what the caller had read, or also an edit made since.- Returns:
- the fingerprint of the bytes read, or
null
-
applied
public boolean applied()Whether the file now holds the edited document.- Returns:
- whether the outcome is written or unchanged
-