[jbosscache-commits] JBoss Cache SVN: r6736 - in core/trunk/src/main/java/org/jboss/cache: marshall and 1 other directory.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Tue Sep 16 12:39:12 EDT 2008


Author: manik.surtani at jboss.com
Date: 2008-09-16 12:39:12 -0400 (Tue, 16 Sep 2008)
New Revision: 6736

Modified:
   core/trunk/src/main/java/org/jboss/cache/io/ExposedByteArrayOutputStream.java
   core/trunk/src/main/java/org/jboss/cache/marshall/VersionAwareMarshaller.java
Log:
marshalling enhancements

Modified: core/trunk/src/main/java/org/jboss/cache/io/ExposedByteArrayOutputStream.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/io/ExposedByteArrayOutputStream.java	2008-09-16 16:06:40 UTC (rev 6735)
+++ core/trunk/src/main/java/org/jboss/cache/io/ExposedByteArrayOutputStream.java	2008-09-16 16:39:12 UTC (rev 6736)
@@ -75,7 +75,7 @@
     * will almost certainly be longer than the data written to it; call
     * <code>size()</code> to get the number of bytes of actual data.
     */
-   public byte[] getRawBuffer()
+   public final byte[] getRawBuffer()
    {
       return buf;
    }
@@ -123,7 +123,7 @@
     * Gets the highest internal buffer size after which if more capacity
     * is needed the buffer will grow in 25% increments rather than 100%.
     */
-   public int getMaxDoublingSize()
+   public final int getMaxDoublingSize()
    {
       return maxDoublingSize;
    }
@@ -135,7 +135,7 @@
     * @param minNewSize the minimum number of bytes required
     * @return the size to which the internal buffer should be resized
     */
-   public int getNewBufferSize(int curSize, int minNewSize)
+   public final int getNewBufferSize(int curSize, int minNewSize)
    {
       if (curSize <= maxDoublingSize)
          return Math.max(curSize << 1, minNewSize);

Modified: core/trunk/src/main/java/org/jboss/cache/marshall/VersionAwareMarshaller.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/VersionAwareMarshaller.java	2008-09-16 16:06:40 UTC (rev 6735)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/VersionAwareMarshaller.java	2008-09-16 16:39:12 UTC (rev 6736)
@@ -154,7 +154,7 @@
    @Override
    public ByteBuffer objectToBuffer(Object obj) throws Exception
    {
-      ExposedByteArrayOutputStream baos = new ExposedByteArrayOutputStream();
+      ExposedByteArrayOutputStream baos = new ExposedByteArrayOutputStream(128);
       ObjectOutputStream out = new ObjectOutputStream(baos);
 
       out.writeShort(versionInt);
@@ -165,7 +165,7 @@
       out.close();
 
       // and return bytes.
-      return new ByteBuffer(baos.toByteArray(), 0, baos.size());
+      return new ByteBuffer(baos.getRawBuffer(), 0, baos.size());
    }
 
    @Override




More information about the jbosscache-commits mailing list