uka.patch
Class PatchReader

java.lang.Object
  extended byuka.patch.PatchReader
All Implemented Interfaces:
Constants, PatchInput

public abstract class PatchReader
extends java.lang.Object
implements PatchInput, Constants

Parser for the patch wire protocol created with a PatchWriter object. This class implements the wire protocol part of the PatchInput interface.


Field Summary
(package private)  int booleanCnt
           
(package private)  boolean booleanValue
           
(package private)  int diffCnt
           
(package private)  int doubleCnt
           
(package private)  double doubleValue
           
(package private)  int floatCnt
           
(package private)  float floatValue
           
(package private)  int fromRank
           
(package private)  UnmarshalStream in
           
(package private)  int intCnt
           
(package private)  int intValue
           
(package private)  LayeredObjectSpace layeredObjectSpace
           
(package private)  int longCnt
           
(package private)  long longValue
           
(package private)  int notModifiedCnt
           
(package private)  int objectCnt
           
(package private)  java.lang.Object objectValue
           
 
Fields inherited from interface uka.patch.Constants
CODE_BOOLEAN, CODE_DOUBLE, CODE_END_OF_PATCH, CODE_FLOAT, CODE_INT16, CODE_INT32, CODE_INT64, CODE_INT8, CODE_NOT_MODIFIED, CODE_NULL, CODE_PATCH_HEADER, CODE_REFERENCE, MAX_DISTRIBUTION_RECORDS
 
Constructor Summary
PatchReader(ObjectSpace objects)
           
PatchReader(ObjectSpace objects, int fromRank)
           
 
Method Summary
 void beginPatch()
           
 int beginPatchRecord()
           
 void clear()
           
 void endPatch()
           
 void endPatchRecord()
           
 boolean getDiffAsBoolean()
           
 byte getDiffAsByte()
           
 char getDiffAsChar()
           
 double getDiffAsDouble()
           
 float getDiffAsFloat()
           
 int getDiffAsInt()
          Reads the updated value, if a patch record is available.
 long getDiffAsLong()
           
 java.lang.Object getDiffAsObject()
          Reads the updated reference value, if the last call to hasDiff() returned true.
 short getDiffAsShort()
           
 int getFromRank()
          Experimental low-level API.
 UnmarshalStream getInput()
          Experimental low-level API: Patch creation for the expert.
 UnmarshalStream getUnmarshalStream()
           
 boolean hasDiff()
          Checks whether there is a patch record available for the next instance variable.
 ObjectSpace init()
           
 void installOverlay()
           
 int rawReadInt()
           
 void setUnmarshalStream(UnmarshalStream in)
           
 void uninstallOverlay()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface uka.patch.PatchInput
applyPatchAnonymous
 

Field Detail

fromRank

int fromRank

in

UnmarshalStream in

layeredObjectSpace

LayeredObjectSpace layeredObjectSpace

diffCnt

int diffCnt

notModifiedCnt

int notModifiedCnt

booleanCnt

int booleanCnt

booleanValue

boolean booleanValue

intCnt

int intCnt

intValue

int intValue

longCnt

int longCnt

longValue

long longValue

floatCnt

int floatCnt

floatValue

float floatValue

doubleCnt

int doubleCnt

doubleValue

double doubleValue

objectCnt

int objectCnt

objectValue

java.lang.Object objectValue
Constructor Detail

PatchReader

public PatchReader(ObjectSpace objects)
            throws java.io.IOException

PatchReader

public PatchReader(ObjectSpace objects,
                   int fromRank)
            throws java.io.IOException
Method Detail

setUnmarshalStream

public void setUnmarshalStream(UnmarshalStream in)

getUnmarshalStream

public UnmarshalStream getUnmarshalStream()

init

public ObjectSpace init()

beginPatch

public void beginPatch()
                throws java.io.IOException
Throws:
java.io.IOException

endPatch

public void endPatch()
              throws java.io.IOException,
                     java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException

clear

public void clear()

installOverlay

public void installOverlay()

uninstallOverlay

public void uninstallOverlay()

beginPatchRecord

public int beginPatchRecord()
                     throws java.io.IOException
Throws:
java.io.IOException

endPatchRecord

public void endPatchRecord()
                    throws java.io.IOException
Throws:
java.io.IOException

hasDiff

public boolean hasDiff()
                throws java.io.IOException,
                       java.lang.ClassNotFoundException
Description copied from interface: PatchInput
Checks whether there is a patch record available for the next instance variable.

Specified by:
hasDiff in interface PatchInput
Throws:
java.io.IOException
java.lang.ClassNotFoundException
See Also:
Patchable.applyPatch(java.lang.Object, uka.patch.PatchInput)

getDiffAsBoolean

public boolean getDiffAsBoolean()
                         throws java.io.IOException
Specified by:
getDiffAsBoolean in interface PatchInput
Throws:
java.io.IOException
See Also:
PatchInput.getDiffAsInt()

getDiffAsByte

public byte getDiffAsByte()
                   throws java.io.IOException
Specified by:
getDiffAsByte in interface PatchInput
Throws:
java.io.IOException
See Also:
PatchInput.getDiffAsInt()

getDiffAsChar

public char getDiffAsChar()
                   throws java.io.IOException
Specified by:
getDiffAsChar in interface PatchInput
Throws:
java.io.IOException
See Also:
PatchInput.getDiffAsInt()

getDiffAsShort

public short getDiffAsShort()
                     throws java.io.IOException
Specified by:
getDiffAsShort in interface PatchInput
Throws:
java.io.IOException
See Also:
PatchInput.getDiffAsInt()

getDiffAsInt

public int getDiffAsInt()
                 throws java.io.IOException
Description copied from interface: PatchInput
Reads the updated value, if a patch record is available.

Specified by:
getDiffAsInt in interface PatchInput
Throws:
java.io.IOException
See Also:
PatchInput.hasDiff(), Patchable.applyPatch(java.lang.Object, uka.patch.PatchInput)

getDiffAsFloat

public float getDiffAsFloat()
                     throws java.io.IOException
Specified by:
getDiffAsFloat in interface PatchInput
Throws:
java.io.IOException
See Also:
PatchInput.getDiffAsInt()

getDiffAsLong

public long getDiffAsLong()
                   throws java.io.IOException
Specified by:
getDiffAsLong in interface PatchInput
Throws:
java.io.IOException
See Also:
PatchInput.getDiffAsInt()

getDiffAsDouble

public double getDiffAsDouble()
                       throws java.io.IOException
Specified by:
getDiffAsDouble in interface PatchInput
Throws:
java.io.IOException
See Also:
PatchInput.getDiffAsInt()

getDiffAsObject

public java.lang.Object getDiffAsObject()
                                 throws java.io.IOException
Description copied from interface: PatchInput
Reads the updated reference value, if the last call to PatchInput.hasDiff() returned true. The returned object reference is assigned to the currently patched instance variable of the patchable object and the corresponding instance variable of its backup copy.

Specified by:
getDiffAsObject in interface PatchInput
Throws:
java.io.IOException

rawReadInt

public int rawReadInt()
               throws java.io.IOException
Throws:
java.io.IOException

getInput

public UnmarshalStream getInput()
                         throws java.io.IOException
Experimental low-level API: Patch creation for the expert.

Specified by:
getInput in interface PatchInput
Returns:
the underlying stream for raw unmarshaling.
Throws:
java.io.IOException

getFromRank

public int getFromRank()
Experimental low-level API.

Specified by:
getFromRank in interface PatchInput
Returns:
the rank that sent the corresponding patch.