Browse Source

amend commit: Support large delta packed objects as streams

Rename the ByteWindow's inflate() method to setInput.  We have
completely refactored the purpose of this method to be feeding part
(or all) of the window as input to the Inflater, and the actual
inflate activity happens in the caller.

Change-Id: Ie93a5bae0e9e637b5e822d56993ce6b562c6ad15
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
stable-0.9
Shawn O. Pearce 15 years ago
parent
commit
f29741d1d8
  1. 2
      org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ByteArrayWindow.java
  2. 2
      org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ByteBufferWindow.java
  3. 6
      org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ByteWindow.java
  4. 4
      org.eclipse.jgit/src/org/eclipse/jgit/storage/file/WindowCursor.java

2
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ByteArrayWindow.java

@ -70,7 +70,7 @@ final class ByteArrayWindow extends ByteWindow {
}
@Override
protected int inflate(final int pos, final Inflater inf)
protected int setInput(final int pos, final Inflater inf)
throws DataFormatException {
int n = array.length - pos;
inf.setInput(array, pos, n);

2
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ByteBufferWindow.java

@ -72,7 +72,7 @@ final class ByteBufferWindow extends ByteWindow {
}
@Override
protected int inflate(final int pos, final Inflater inf)
protected int setInput(final int pos, final Inflater inf)
throws DataFormatException {
final ByteBuffer s = buffer.slice();
s.position(pos);

6
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ByteWindow.java

@ -117,10 +117,10 @@ abstract class ByteWindow {
*/
protected abstract int copy(int pos, byte[] dstbuf, int dstoff, int cnt);
final int inflate(long pos, Inflater inf) throws DataFormatException {
return inflate((int) (pos - start), inf);
final int setInput(long pos, Inflater inf) throws DataFormatException {
return setInput((int) (pos - start), inf);
}
protected abstract int inflate(int pos, Inflater inf)
protected abstract int setInput(int pos, Inflater inf)
throws DataFormatException;
}

4
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/WindowCursor.java

@ -171,13 +171,13 @@ final class WindowCursor extends ObjectReader implements ObjectReuseAsIs {
int dstoff) throws IOException, DataFormatException {
prepareInflater();
pin(pack, position);
position += window.inflate(position, inf);
position += window.setInput(position, inf);
do {
int n = inf.inflate(dstbuf, dstoff, dstbuf.length - dstoff);
if (n == 0) {
if (inf.needsInput()) {
pin(pack, position);
position += window.inflate(position, inf);
position += window.setInput(position, inf);
} else if (inf.finished())
return dstoff;
else

Loading…
Cancel
Save