TrueUpdate Core 0.1.7

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

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

@Immutable
public final class DiffModel
extends Object
implements Serializable

A Value Object which represents the meta data in a ZIP patch 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 DiffModel.Builder
          A builder for a diff model.
 
Field Summary
static String ENTRY_NAME
          The name of the entry which contains the marshalled diff model in a ZIP patch 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 DiffModel.Builder builder()
          Returns a new builder for a diff 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 DiffModel decodeFromXml(Source source)
          Decodes a diff 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 diff 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 diff model in a ZIP patch file. This should be the first entry in the ZIP patch 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 DiffModel.Builder builder()
Returns a new builder for a diff 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 DiffModel decodeFromXml(Source source)
                               throws Exception
Decodes a diff model from XML.

Parameters:
source - the source for reading the XML.
Returns:
the decoded diff 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 diff model is the default value for the algorithm.


encodeToXml

public void encodeToXml(Sink sink)
                 throws Exception
Encodes this diff 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.1.7

Copyright © 2013 Stimulus Software. All rights reserved.