Author: nextgens
Date: 2008-08-30 21:43:11 +0000 (Sat, 30 Aug 2008)
New Revision: 22260
Modified:
trunk/freenet/src/freenet/support/io/TempBucketFactory.java
Log:
TempBucket: revert r22259 as they are complications... and anyway let's KISS
and get it to work first before optimizing.
Modified: trunk/freenet/src/freenet/support/io/TempBucketFactory.java
===================================================================
--- trunk/freenet/src/freenet/support/io/TempBucketFactory.java 2008-08-30
21:20:53 UTC (rev 22259)
+++ trunk/freenet/src/freenet/support/io/TempBucketFactory.java 2008-08-30
21:43:11 UTC (rev 22260)
@@ -13,7 +13,6 @@
import freenet.support.api.Bucket;
import freenet.support.api.BucketFactory;
-import java.io.BufferedInputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.LinkedList;
@@ -229,7 +228,7 @@
private class TempBucketInputStream extends InputStream {
/** The current InputStream we use from the underlying
bucket */
- private BufferedInputStream currentIS;
+ private InputStream currentIS;
/** Keep a link to the current OutputStream to know
when to reset the stream */
private OutputStream currentOS;
/** Keep a counter to know where we are on the stream
(useful when we have to reset and skip) */
@@ -239,10 +238,7 @@
TempBucketInputStream(short idx) throws IOException {
this.idx = idx;
- // Neither bucket types
(ArrayBuckets|TempFileBuckets) do support marks...
- // So we use a BufferedInputStream which does.
- // TODO: Obviously we should implement it.
- this.currentIS = new
BufferedInputStream(currentBucket.getInputStream());
+ this.currentIS = currentBucket.getInputStream();
this.currentOS = os;
}
@@ -252,7 +248,7 @@
if(currentOS != os) {
Closer.close(currentIS);
- currentIS = new
BufferedInputStream(currentBucket.getInputStream());
+ currentIS =
currentBucket.getInputStream();
currentIS.skip(index);
currentOS = os;
}
@@ -303,26 +299,10 @@
@Override
public boolean markSupported() {
- synchronized(TempBucket.this) {
- return currentIS.markSupported();
- }
+ return false;
}
@Override
- public void mark(int readlimit) {
- synchronized(TempBucket.this) {
- currentIS.mark(readlimit);
- }
- }
-
- @Override
- public void reset() throws IOException {
- synchronized(TempBucket.this) {
- currentIS.reset();
- }
- }
-
- @Override
public final void close() throws IOException {
synchronized(TempBucket.this) {
Closer.close(currentIS);