Merge "Use the ObjectStream size during copyTo"
This commit is contained in:
commit
595a20a064
|
@ -166,6 +166,7 @@ public void copyTo(OutputStream out) throws MissingObjectException,
|
|||
if (isLarge()) {
|
||||
ObjectStream in = openStream();
|
||||
try {
|
||||
final long sz = in.getSize();
|
||||
byte[] tmp = new byte[1024];
|
||||
long copied = 0;
|
||||
for (;;) {
|
||||
|
@ -175,7 +176,7 @@ public void copyTo(OutputStream out) throws MissingObjectException,
|
|||
out.write(tmp, 0, n);
|
||||
copied += n;
|
||||
}
|
||||
if (copied != getSize())
|
||||
if (copied != sz)
|
||||
throw new EOFException();
|
||||
} finally {
|
||||
in.close();
|
||||
|
|
Loading…
Reference in New Issue