[jbosscache-commits] JBoss Cache SVN: r5301 - core/trunk/src/main/java/org/jboss/cache/marshall/io.
jbosscache-commits at lists.jboss.org
jbosscache-commits at lists.jboss.org
Tue Feb 5 16:10:35 EST 2008
Author: manik.surtani at jboss.com
Date: 2008-02-05 16:10:35 -0500 (Tue, 05 Feb 2008)
New Revision: 5301
Modified:
core/trunk/src/main/java/org/jboss/cache/marshall/io/ReusableObjectOutputStream.java
Log:
Higher default byte array size
Modified: core/trunk/src/main/java/org/jboss/cache/marshall/io/ReusableObjectOutputStream.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/io/ReusableObjectOutputStream.java 2008-02-05 21:09:54 UTC (rev 5300)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/io/ReusableObjectOutputStream.java 2008-02-05 21:10:35 UTC (rev 5301)
@@ -19,6 +19,7 @@
{
ResettableByteArrayOutputStream baos;
boolean initialised = false;
+ private static int defaultBufferSize = 128;
public ReusableObjectOutputStream() throws IOException, SecurityException
{
@@ -76,6 +77,11 @@
*/
static class ResettableByteArrayOutputStream extends ByteArrayOutputStream
{
+ ResettableByteArrayOutputStream()
+ {
+ super(defaultBufferSize);
+ }
+
int getBufSize()
{
return buf.length;
@@ -84,12 +90,12 @@
public void trim()
{
// make sure we trim the buffer array to it's original size, to save on memory
- buf = null;
+ if (buf.length > defaultBufferSize) buf = null;
}
public void init()
{
- buf = new byte[32];
+ if (buf == null) buf = new byte[defaultBufferSize];
count = 0;
}
}
More information about the jbosscache-commits
mailing list