TrueUpdate Core 0.5

net.java.trueupdate.core.zip.model
Class DeltaModel

java.lang.Object
  extended by net.java.trueupdate.core.zip.model.DeltaModel
All Implemented Interfaces:
Serializable

@Immutable
public final class DeltaModel
extends Object
implements Serializable

A Value Object which represents the meta data in a delta ZIP file. It encapsulates unmodifiable collections of changed, unchanged, added and removed entry names and message digests in canonical string notation, attributed with the message digest algorithm name and byte length.

Author:
Christian Schlichtherle
See Also:
Serialized Form

Nested Class Summary
static class DeltaModel.Builder
          A builder for a delta model.
 
Field Summary
static String ENTRY_NAME
          The name of the entry which contains the marshalled delta model in a delta ZIP file.
 
Method Summary
 EntryNameAndDigest added(String name)
          Looks up the given entry name in the added entries.
 Collection<EntryNameAndDigest> addedEntries()
          Returns a collection of the entry name and message digest for the added entries.
static DeltaModel.Builder builder()
          Returns a new builder for a delta model.
 EntryNameAndTwoDigests changed(String name)
          Looks up the given entry name in the changed entries.
 Collection<EntryNameAndTwoDigests> changedEntries()
          Returns a collection of the entry name and two message digests for the changed entries.
static DeltaModel decodeFromXml(Source source)
          Decodes a delta model from XML.
 String digestAlgorithmName()
          Returns the message digest algorithm name.
 Integer digestByteLength()
          Returns the message digest byte length.
 void encodeToXml(Sink sink)
          Encodes this delta model to XML.
 boolean equals(Object obj)
           
 int hashCode()
           
static JAXBContext jaxbContext()
          Returns a JAXB context which binds only this class.
 EntryNameAndDigest removed(String name)
          Deprecated. 
 Collection<EntryNameAndDigest> removedEntries()
          Returns a collection of the entry name and message digest for the removed entries.
 EntryNameAndDigest unchanged(String name)
          Deprecated. 
 Collection<EntryNameAndDigest> unchangedEntries()
          Returns a collection of the entry name and message digest for the unchanged entries.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENTRY_NAME

public static final String ENTRY_NAME
The name of the entry which contains the marshalled delta model in a delta ZIP file. This should be the first entry in the delta ZIP file.

See Also:
Constant Field Values
Method Detail

added

public EntryNameAndDigest added(String name)
Looks up the given entry name in the added entries.


addedEntries

public Collection<EntryNameAndDigest> addedEntries()
Returns a collection of the entry name and message digest for the added entries.


builder

public static DeltaModel.Builder builder()
Returns a new builder for a delta model.


changed

public EntryNameAndTwoDigests changed(String name)
Looks up the given entry name in the changed entries.


changedEntries

public Collection<EntryNameAndTwoDigests> changedEntries()
Returns a collection of the entry name and two message digests for the changed entries.


decodeFromXml

public static DeltaModel decodeFromXml(Source source)
                                throws Exception
Decodes a delta model from XML.

Parameters:
source - the source for reading the XML.
Returns:
the decoded delta model.
Throws:
Exception - at the discretion of the JAXB codec, e.g. if the source isn't readable.

digestAlgorithmName

public String digestAlgorithmName()
Returns the message digest algorithm name.


digestByteLength

@Nullable
public Integer digestByteLength()
Returns the message digest byte length. This is null if and only if the byte length of the message digest used to build this delta model is the default value for the algorithm.


encodeToXml

public void encodeToXml(Sink sink)
                 throws Exception
Encodes this delta model to XML.

Parameters:
sink - the sink for writing the XML.
Throws:
Exception - at the discretion of the JAXB codec, e.g. if the sink isn't writable.

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

jaxbContext

public static JAXBContext jaxbContext()
Returns a JAXB context which binds only this class.


removed

@Deprecated
public EntryNameAndDigest removed(String name)
Deprecated. 

Looks up the given entry name in the removed entries.


removedEntries

public Collection<EntryNameAndDigest> removedEntries()
Returns a collection of the entry name and message digest for the removed entries.


unchanged

@Deprecated
public EntryNameAndDigest unchanged(String name)
Deprecated. 

Looks up the given entry name in the unchanged entries.


unchangedEntries

public Collection<EntryNameAndDigest> unchangedEntries()
Returns a collection of the entry name and message digest for the unchanged entries.


TrueUpdate Core 0.5

Copyright © 2013 Schlichtherle IT Services. All rights reserved.