Author: toad
Date: 2007-05-19 20:55:34 +0000 (Sat, 19 May 2007)
New Revision: 13275

Modified:
   trunk/freenet/src/freenet/support/io/RandomAccessFileBucket.java
Log:
Delete localOffset. It's a relic from the old buckets api including 
resetWrite(). We don't need it now.

Modified: trunk/freenet/src/freenet/support/io/RandomAccessFileBucket.java
===================================================================
--- trunk/freenet/src/freenet/support/io/RandomAccessFileBucket.java    
2007-05-19 20:51:03 UTC (rev 13274)
+++ trunk/freenet/src/freenet/support/io/RandomAccessFileBucket.java    
2007-05-19 20:55:34 UTC (rev 13275)
@@ -21,7 +21,6 @@

     private final File file;
     private final long offset;
-    private long localOffset = 0;
     private final long len;
     private boolean readOnly = false;
     private boolean released = false;
@@ -114,17 +113,6 @@
             (offset + len - 1) + ']';
     }

-    public synchronized void resetWrite() {
-        if (isReleased()) {
-            throw new RuntimeException("Attempt to use a released 
RandomAccessFileBucket: " + getName() );
-        }
-        // REDFLAG: implicit assumptions
-        // 0) Bucket is only written to at a time.
-        // 1) The output stream is closed before the
-        //    next is open. Ouch. This may cause problems...
-        localOffset = 0;
-    }
-
     public long size() { return len; }

     public synchronized boolean release() {
@@ -351,7 +339,7 @@
     private class RAOutputStream extends OutputStream {
         public RAOutputStream(String pref) throws IOException {
             raf = new RandomAccessFile(file, "rw");
-            raf.seek(offset + localOffset);
+            raf.seek(offset);
             println(" -- Created new OutputStream [" + offset + ", " 
                     + (offset + len -1) + ']');
         }
@@ -411,12 +399,6 @@
                     streams.removeElement(RAOutputStream.this);
                 }
                 streams.trimToSize();
-                long added = raf.getFilePointer() - offset;
-                if (added > 0) {
-                    // To get proper append behavior.
-                    localOffset = added;
-                }
-                
                 raf.close();
             }
         }


Reply via email to