org.sourcejammer.server.make
Class BufferedChunkCompare

java.lang.Object
  |
  +--org.sourcejammer.server.make.ByteArrayChunkCompare
        |
        +--org.sourcejammer.server.make.BufferedChunkCompare

public class BufferedChunkCompare
extends ByteArrayChunkCompare


Field Summary
private  ByteArrayBuffer buffer
           
private  int bufferChunkIndex
           
private  int chunkIndex
           
private  int chunkSize
           
private  int discardBeforeIndex
           
private  int fileSize
           
private  int maxBufferSize
           
private  int maxChunkSize
           
private  boolean mbProvideOutputBytes
           
private  int nextBufferStartIndex
           
private  java.io.File source
           
private  BytesToAddStreamer stmInForOutput
           
private  java.lang.String tempName
           
 
Fields inherited from class org.sourcejammer.server.make.ByteArrayChunkCompare
 
Constructor Summary
protected BufferedChunkCompare()
           
  BufferedChunkCompare(java.io.File source, boolean provideOutputBytes)
           
 
Method Summary
private  int bufferIndexToFileIndex(int bufferIndex)
           
 void close()
          Returns number of bytes added.
 boolean equals(java.lang.Object o)
          Tests if the current chunk of bytes in this ByteArrayChunkCompare object is equal to the current chunk of bytes in o.
private  int fileIndexToBufferIndex(int fileIndex)
           
protected  void finailze()
           
 int firstUnmatchedByte(BufferedChunkCompare oCompare)
           
 int getIndex()
           
 int getSizeOfSource()
           
private  boolean isFileIndexInCurrentBuffer(int fileIndex)
           
 boolean nextByByte()
          Advances the index of the byte array source by 1 byte.
 boolean nextByChunk()
          Advances the index of the byte array source to the next byte chunk.
private  void refreshBuffer()
           
 byte[] retrieveBytes(int startIndex, int length)
           
 void setIndex(int index)
          Explicitly sets the index value.
 void setIndex(int index, boolean optimistic)
          Explicitly sets the index value.
 void setTempName(java.lang.String s)
           
 int size()
          Returns the comparison size, or the number of bytes that will be compared when the equals() method is called.
 
Methods inherited from class org.sourcejammer.server.make.ByteArrayChunkCompare
getSource
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

source

private java.io.File source

chunkIndex

private int chunkIndex

chunkSize

private int chunkSize

discardBeforeIndex

private int discardBeforeIndex

maxBufferSize

private int maxBufferSize

maxChunkSize

private int maxChunkSize

nextBufferStartIndex

private int nextBufferStartIndex

mbProvideOutputBytes

private boolean mbProvideOutputBytes

stmInForOutput

private BytesToAddStreamer stmInForOutput

buffer

private ByteArrayBuffer buffer

bufferChunkIndex

private int bufferChunkIndex

fileSize

private int fileSize

tempName

private java.lang.String tempName
Constructor Detail

BufferedChunkCompare

protected BufferedChunkCompare()

BufferedChunkCompare

public BufferedChunkCompare(java.io.File source,
                            boolean provideOutputBytes)
                     throws java.io.IOException,
                            EndOfSourceException
Method Detail

setTempName

public void setTempName(java.lang.String s)

refreshBuffer

private void refreshBuffer()
                    throws java.io.IOException
java.io.IOException

retrieveBytes

public byte[] retrieveBytes(int startIndex,
                            int length)
                     throws java.lang.IndexOutOfBoundsException,
                            java.io.IOException
java.lang.IndexOutOfBoundsException
java.io.IOException

fileIndexToBufferIndex

private int fileIndexToBufferIndex(int fileIndex)

bufferIndexToFileIndex

private int bufferIndexToFileIndex(int bufferIndex)

nextByChunk

public boolean nextByChunk()
Description copied from class: ByteArrayChunkCompare
Advances the index of the byte array source to the next byte chunk. In other words, advances the index by the value of the ComparisonChunkSize value in AppConfig.

Overrides:
nextByChunk in class ByteArrayChunkCompare
Returns:
true if the index advanced successfully. false if the end of the source byte array has been reached.

nextByByte

public boolean nextByByte()
Description copied from class: ByteArrayChunkCompare
Advances the index of the byte array source by 1 byte.

Overrides:
nextByByte in class ByteArrayChunkCompare
Returns:
true if the index advanced successfully. false if the end of the source byte array has been reached.

setIndex

public void setIndex(int index)
              throws EndOfSourceException
Explicitly sets the index value.

Overrides:
setIndex in class ByteArrayChunkCompare
Throws:
EndOfSourceException - -- Requested index is not in source byte array.

setIndex

public void setIndex(int index,
                     boolean optimistic)
              throws EndOfSourceException
Explicitly sets the index value.

Parameters:
index - -- the index to move to.
optimistic - -- means "discard before" value is not modified.
Throws:
EndOfSourceException - -- Requested index is not in source byte array.

isFileIndexInCurrentBuffer

private boolean isFileIndexInCurrentBuffer(int fileIndex)

getIndex

public int getIndex()
Overrides:
getIndex in class ByteArrayChunkCompare

size

public int size()
Returns the comparison size, or the number of bytes that will be compared when the equals() method is called.

Overrides:
size in class ByteArrayChunkCompare

getSizeOfSource

public int getSizeOfSource()
Overrides:
getSizeOfSource in class ByteArrayChunkCompare

equals

public boolean equals(java.lang.Object o)
Tests if the current chunk of bytes in this ByteArrayChunkCompare object is equal to the current chunk of bytes in o.

Overrides:
equals in class ByteArrayChunkCompare

firstUnmatchedByte

public int firstUnmatchedByte(BufferedChunkCompare oCompare)

close

public void close()
           throws java.io.IOException
Returns number of bytes added.

java.io.IOException

finailze

protected void finailze()
                 throws java.lang.Throwable
java.lang.Throwable


Copyright © 2003 Soucejammer project.