Skip to content
This repository has been archived by the owner on Sep 23, 2020. It is now read-only.

Commit

Permalink
patch prevents the cloud client progress bar from going above 100% on…
Browse files Browse the repository at this point in the history
… retries
  • Loading branch information
BuzzTroll committed Jul 14, 2010
1 parent ce6299a commit ce44924
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ class CumulusInputStream
private InputStream is;
private PrintStream pr;
private CloudProgressPrinter progress;
private long where = 0;
private long marked = 0;

public CumulusInputStream(
long len,
Expand Down Expand Up @@ -245,6 +247,7 @@ public void close()

public void mark(int readlimit)
{
marked = where;
this.is.mark(readlimit);
}

Expand All @@ -253,12 +256,18 @@ public boolean markSupported()
return this.is.markSupported();
}

private void updatePosition(int len)
{
where += len;
progress.updateBytesTransferred(len);
}

public int read()
throws java.io.IOException
{
int len;
len = this.is.read();
progress.updateBytesTransferred((long)len);
updatePosition(len);
return len;
}

Expand All @@ -267,7 +276,7 @@ public int read(byte[] b)
{
int len;
len = this.is.read(b);
progress.updateBytesTransferred((long)len);
updatePosition(len);
return len;
}

Expand All @@ -276,13 +285,16 @@ public int read(byte[] b, int off, int len)
{
int lenrc;
lenrc = this.is.read(b, off, len);
updatePosition(lenrc);
return lenrc;
}

public void reset()
throws java.io.IOException
{
long diff = marked - where;
this.is.reset();
updatePosition((int)diff);
}

public long skip(long n)
Expand Down

0 comments on commit ce44924

Please sign in to comment.