Author: manik.surtani(a)jboss.com
Date: 2008-09-19 10:34:58 -0400 (Fri, 19 Sep 2008)
New Revision: 6761
Modified:
core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java
Log:
Buffered read for byte arrays
Modified: core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java 2008-09-19
13:01:33 UTC (rev 6760)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java 2008-09-19
14:34:58 UTC (rev 6761)
@@ -937,7 +937,15 @@
if (isPrim)
{
byte[] a = new byte[sz];
- in.read(a);
+ int bsize = 10240;
+ int offset = 0;
+ int bytesLeft = sz;
+ while (bytesLeft > 0)
+ {
+ int read = in.read(a, offset, Math.min(bsize, bytesLeft));
+ offset += read;
+ bytesLeft -= read;
+ }
return a;
}
else