[infinispan-dev] AbstractMarshaller needed for common impls

Galder Zamarreño galder at redhat.com
Tue Aug 3 09:33:22 EDT 2010


Hi,

I think we could use with having an AbstractMarshaller with common implementations for:

   public ByteBuffer objectToBuffer(Object obj) throws IOException {
      return objectToBuffer(obj, DEFAULT_BUF_SIZE);
   }

   public byte[] objectToByteBuffer(Object obj, int estimatedSize) throws IOException {
      ByteBuffer b = objectToBuffer(obj, estimatedSize);
      byte[] bytes = new byte[b.getLength()];
      System.arraycopy(b.getBuf(), b.getOffset(), bytes, 0, b.getLength());
      return bytes;
   }

   public Object objectFromByteBuffer(byte[] buf) throws IOException, ClassNotFoundException {
      return objectFromByteBuffer(buf, 0, buf.length);
   }

These 3 methods have exactly the same impl in GenericJBossMarshaller.

I'll go ahead with this.

Cheers,
--
Galder Zamarreño
Sr. Software Engineer
Infinispan, JBoss Cache




More information about the infinispan-dev mailing list