You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2013/08/08 03:47:36 UTC

svn commit: r1511554 - in /commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram: RamFileData.java RamFileObject.java RamFileOutputStream.java RamFileRandomAccessContent.java RamFileSystem.java

Author: ggregory
Date: Thu Aug  8 01:47:35 2013
New Revision: 1511554

URL: http://svn.apache.org/r1511554
Log:
[VFS-483][RAM] Many suggestions to improve the RAM file provider. Rename ivar buffer to content, also rename package private accessors.

Modified:
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileData.java
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileObject.java
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileOutputStream.java
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileRandomAccessContent.java
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileSystem.java

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileData.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileData.java?rev=1511554&r1=1511553&r2=1511554&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileData.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileData.java Thu Aug  8 01:47:35 2013
@@ -48,7 +48,7 @@ class RamFileData implements Serializabl
     /**
      * Bytes.
      */
-    private byte[] buffer;
+    private byte[] content;
 
     /**
      * Last modified time
@@ -79,18 +79,18 @@ class RamFileData implements Serializabl
     /**
      * @return Returns the buffer.
      */
-    byte[] getBuffer()
+    byte[] getContent()
     {
-        return buffer;
+        return content;
     }
 
     /**
      * @param buffer The buffer.
      */
-    void setBuffer(final byte[] buffer)
+    void setContent(final byte[] buffer)
     {
         updateLastModified();
-        this.buffer = buffer;
+        this.content = buffer;
     }
 
     /**
@@ -131,7 +131,7 @@ class RamFileData implements Serializabl
      */
     void clear()
     {
-        this.buffer = new byte[0];
+        this.content = new byte[0];
         updateLastModified();
         this.type = FileType.IMAGINARY;
         this.children.clear();
@@ -264,7 +264,7 @@ class RamFileData implements Serializabl
      */
     int size()
     {
-        return buffer.length;
+        return content.length;
     }
 
     /**
@@ -283,8 +283,8 @@ class RamFileData implements Serializabl
         final int resize = (int) newSize;
         final int size = this.size();
         final byte[] newBuf = new byte[resize];
-        System.arraycopy(this.buffer, 0, newBuf, 0, Math.min(resize, size));
-        this.buffer = newBuf;
+        System.arraycopy(this.content, 0, newBuf, 0, Math.min(resize, size));
+        this.content = newBuf;
         updateLastModified();
     }
 

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileObject.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileObject.java?rev=1511554&r1=1511553&r2=1511554&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileObject.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileObject.java Thu Aug  8 01:47:35 2013
@@ -89,7 +89,7 @@ public class RamFileObject extends Abstr
     @Override
     protected long doGetContentSize() throws Exception
     {
-        return this.data.getBuffer().length;
+        return this.data.getContent().length;
     }
 
     /*
@@ -106,7 +106,7 @@ public class RamFileObject extends Abstr
             throw new FileSystemException("vfs.provider/read-not-file.error", getName());
         }
 
-        return new ByteArrayInputStream(this.data.getBuffer());
+        return new ByteArrayInputStream(this.data.getContent());
     }
 
     /*
@@ -119,7 +119,7 @@ public class RamFileObject extends Abstr
     {
         if (!bAppend)
         {
-            this.data.setBuffer(new byte[0]);
+            this.data.setContent(new byte[0]);
         }
         return new RamFileOutputStream(this);
     }

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileOutputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileOutputStream.java?rev=1511554&r1=1511553&r2=1511554&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileOutputStream.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileOutputStream.java Thu Aug  8 01:47:35 2013
@@ -71,7 +71,7 @@ public class RamFileOutputStream extends
             this.exc = e;
             throw e;
         }
-        System.arraycopy(b, off, this.file.getData().getBuffer(), size, len);
+        System.arraycopy(b, off, this.file.getData().getContent(), size, len);
     }
 
     /*

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileRandomAccessContent.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileRandomAccessContent.java?rev=1511554&r1=1511553&r2=1511554&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileRandomAccessContent.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileRandomAccessContent.java Thu Aug  8 01:47:35 2013
@@ -80,7 +80,7 @@ public class RamFileRandomAccessContent 
     public RamFileRandomAccessContent(final RamFileObject file, final RandomAccessMode mode)
     {
         super();
-        this.buf = file.getData().getBuffer();
+        this.buf = file.getData().getContent();
         this.file = file;
         this.mode = mode;
 
@@ -399,7 +399,7 @@ public class RamFileRandomAccessContent 
         {
             final int newSize = this.buf.length + len - this.getLeftBytes();
             this.file.resize(newSize);
-            this.buf = this.file.getData().getBuffer();
+            this.buf = this.file.getData().getContent();
         }
         System.arraycopy(b, off, this.buf, filePointer, len);
         this.filePointer += len;
@@ -653,6 +653,6 @@ public class RamFileRandomAccessContent 
     public void setLength(final long newLength) throws IOException
     {
         this.file.resize(newLength);
-        this.buf = this.file.getData().getBuffer();
+        this.buf = this.file.getData().getContent();
     }
 }

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileSystem.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileSystem.java?rev=1511554&r1=1511553&r2=1511554&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileSystem.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileSystem.java Thu Aug  8 01:47:35 2013
@@ -197,7 +197,7 @@ public class RamFileSystem extends Abstr
         }
         // Copy data
 
-        to.getData().setBuffer(from.getData().getBuffer());
+        to.getData().setContent(from.getData().getContent());
         to.getData().setLastModified(from.getData().getLastModified());
         to.getData().setType(from.getData().getType());