Author: nextgens
Date: 2008-11-16 23:01:34 +0000 (Sun, 16 Nov 2008)
New Revision: 23667
Modified:
trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
trunk/freenet/src/freenet/support/io/BucketTools.java
Log:
logging
Modified: trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
2008-11-16 22:33:31 UTC (rev 23666)
+++ trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
2008-11-16 23:01:34 UTC (rev 23667)
@@ -230,12 +230,13 @@
decodedData =
fetchContext.bucketFactory.makeBucket(maxBlockLength * dataBuckets.length);
if(logMINOR) Logger.minor(this, "Copying data from data
blocks");
OutputStream os = decodedData.getOutputStream();
+ long osSize = 0;
for(int i=0;i<dataBuckets.length;i++) {
SplitfileBlock status = dataBuckets[i];
Bucket data = status.getData();
- BucketTools.copyTo(data, os, Long.MAX_VALUE);
+ osSize += BucketTools.copyTo(data, os,
Long.MAX_VALUE);
}
- if(logMINOR) Logger.minor(this, "Copied data");
+ if(logMINOR) Logger.minor(this, "Copied data
("+osSize+")");
os.close();
// Must set finished BEFORE calling parentFetcher.
// Otherwise a race is possible that might result in it
not seeing our finishing.
Modified: trunk/freenet/src/freenet/support/io/BucketTools.java
===================================================================
--- trunk/freenet/src/freenet/support/io/BucketTools.java 2008-11-16
22:33:31 UTC (rev 23666)
+++ trunk/freenet/src/freenet/support/io/BucketTools.java 2008-11-16
23:01:34 UTC (rev 23667)
@@ -270,8 +270,8 @@
/** Copy the given quantity of data from the given bucket to the given
OutputStream.
* @throws IOException If there was an error reading from the bucket or
writing to the stream. */
- public static void copyTo(Bucket decodedData, OutputStream os, long
truncateLength) throws IOException {
- if(truncateLength == 0) return;
+ public static long copyTo(Bucket decodedData, OutputStream os, long
truncateLength) throws IOException {
+ if(truncateLength == 0) return 0;
if(truncateLength < 0) truncateLength = Long.MAX_VALUE;
InputStream is = decodedData.getInputStream();
try {
@@ -293,6 +293,7 @@
os.write(buf, 0, bytes);
moved += bytes;
}
+ return moved;
} finally {
is.close();
os.flush();
_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs