org.sourcejammer.server.make
Class BuildDelta

java.lang.Object
  |
  +--org.sourcejammer.server.make.BuildDelta

public class BuildDelta
extends java.lang.Object


Nested Class Summary
private  class BuildDelta.MatchChunksResult
          Inner class for encapsulating the results of a comparision of a chunk of bytes from each byte array to it's opposite.
private  class BuildDelta.SearchRange
           
 
Field Summary
private  boolean mbDebug
           
 
Constructor Summary
BuildDelta()
           
 
Method Summary
 BinaryDelta buildBinaryDelta(byte[] byOld, byte[] byNew)
          Builds a delta file (BinaryDelta) representing the difference between the two byte arrays such that byNew can be reconstructed using just the BinaryDelta constructed here and byOld.
 TextDiff buildTextDelta(byte[] byOld, byte[] byNew)
           
 TextDiff buildTextDelta(byte[] byOld, TextLineReader readerNew)
           
 TextDiff buildTextDelta(TextLineReader readerOld, TextLineReader readerNew)
           
 boolean getDebug()
           
private  BuildDelta.MatchChunksResult matchCurrentChunks(ByteArrayChunkCompare oNewChunk, ByteArrayChunkCompare oOldChunk, BuildDelta.SearchRange oNewRange, BuildDelta.SearchRange oOldRange)
          Note that the purpose of oTemp01 and oTemp02 is to avoid unnecessary object instantiation.
private  BuildDelta.MatchChunksResult matchCurrentLines(java.lang.String sNewLine, java.lang.String sOldLine, TextLineReader oNewRef, TextLineReader oOldRef)
          Note that the purpose of oTemp01 and oTemp02 is to avoid unnecessary object instantiation.
 void setDebug(boolean b)
          If set to true, buildBinaryDelta() and buildTextDelta() output messages to default output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mbDebug

private boolean mbDebug
Constructor Detail

BuildDelta

public BuildDelta()
Method Detail

setDebug

public void setDebug(boolean b)
If set to true, buildBinaryDelta() and buildTextDelta() output messages to default output.


getDebug

public boolean getDebug()

buildBinaryDelta

public BinaryDelta buildBinaryDelta(byte[] byOld,
                                    byte[] byNew)
                             throws InvalidSourceException,
                                    EndOfSourceException
Builds a delta file (BinaryDelta) representing the difference between the two byte arrays such that byNew can be reconstructed using just the BinaryDelta constructed here and byOld.

Parameters:
byOld - -- an array of all the bytes in the "old" file version.
byNew - -- an array of all the bytes in the new file version.
Returns:
a BinaryDelta object, that encapsulates the differences between the two versions.
Throws:
InvalidSourceException - -- if there is a problem with one of the two source byte arrays.
EndOfSourceException - -- if the end of one of the source files is hit unexpectedly. Actually, I don't think this should ever be thrown.

matchCurrentChunks

private BuildDelta.MatchChunksResult matchCurrentChunks(ByteArrayChunkCompare oNewChunk,
                                                        ByteArrayChunkCompare oOldChunk,
                                                        BuildDelta.SearchRange oNewRange,
                                                        BuildDelta.SearchRange oOldRange)
                                                 throws EndOfSourceException
Note that the purpose of oTemp01 and oTemp02 is to avoid unnecessary object instantiation. oTemp01 and oChunk01 should point to the same byte array and so should oTemp02 adn oChunk02. Basically, this method searches all oTemp01 for a match of current chunk in oChunk02 and vice versa.

EndOfSourceException

buildTextDelta

public TextDiff buildTextDelta(byte[] byOld,
                               byte[] byNew)
                        throws InvalidSourceException,
                               EndOfSourceException,
                               java.io.IOException
InvalidSourceException
EndOfSourceException
java.io.IOException

buildTextDelta

public TextDiff buildTextDelta(byte[] byOld,
                               TextLineReader readerNew)
                        throws InvalidSourceException,
                               EndOfSourceException,
                               java.io.IOException
InvalidSourceException
EndOfSourceException
java.io.IOException

buildTextDelta

public TextDiff buildTextDelta(TextLineReader readerOld,
                               TextLineReader readerNew)
                        throws InvalidSourceException,
                               EndOfSourceException,
                               java.io.IOException
InvalidSourceException
EndOfSourceException
java.io.IOException

matchCurrentLines

private BuildDelta.MatchChunksResult matchCurrentLines(java.lang.String sNewLine,
                                                       java.lang.String sOldLine,
                                                       TextLineReader oNewRef,
                                                       TextLineReader oOldRef)
                                                throws EndOfSourceException
Note that the purpose of oTemp01 and oTemp02 is to avoid unnecessary object instantiation. oTemp01 and oChunk01 should point to the same byte array and so should oTemp02 adn oChunk02. Basically, this method searches all oTemp01 for a match of current chunk in oChunk02 and vice versa.

EndOfSourceException


Copyright 2003 Soucejammer project.