Package org.infinispan.commons.io

Examples of org.infinispan.commons.io.ByteBufferImpl


      try {
         objectToObjectStream(o, marshaller);
      } finally {
         finishObjectOutput(marshaller);
      }
      return new ByteBufferImpl(baos.getRawBuffer(), 0, baos.size());
   }
View Full Code Here


            throw ioe;
         }
      } finally {
         finishObjectOutput(out);
      }
      return new ByteBufferImpl(baos.getRawBuffer(), 0, baos.size());
   }
View Full Code Here

      try {
         objectToObjectStream(o, marshaller);
      } finally {
         finishObjectOutput(marshaller);
      }
      return new ByteBufferImpl(baos.getRawBuffer(), 0, baos.size());
   }
View Full Code Here

   @Override
   protected ByteBuffer objectToBuffer(Object o, int estimatedSize) throws IOException {
      ExposedByteArrayOutputStream baos = new ExposedByteArrayOutputStream(estimatedSize);
      Encoder encoder = new BinaryEncoder(baos);
      objectToBuffer(o, encoder);
      return new ByteBufferImpl(baos.getRawBuffer(), 0, baos.size());
   }
View Full Code Here

      objectToObjectStream(o, oos);
      oos.flush();
      oos.close();
      baos.close();
      byte[] b = baos.toByteArray();
      return new ByteBufferImpl(b, 0, b.length);
   }
View Full Code Here

         ByteBuffer byteBuffer = objectToBuffer(obj, estimatedSize);
         int length = byteBuffer.getLength();
         // If the prediction is way off, then trim it
         if (estimatedSize > (length * 4)) {
            byte[] buffer = trimBuffer(byteBuffer);
            byteBuffer = new ByteBufferImpl(buffer, 0, buffer.length);
         }
         sizePredictor.recordSize(length);
         return byteBuffer;
      } else {
         return objectToBuffer(null, 1);
View Full Code Here

      ObjectOutput out = new ObjectOutputStream(baos);
      out.writeObject(o);
      out.close();
      baos.close();
      byte[] bytes = baos.toByteArray();
      return new ByteBufferImpl(bytes, 0, bytes.length);
   }
View Full Code Here

      try {
         objectToObjectStream(o, marshaller);
      } finally {
         finishObjectOutput(marshaller);
      }
      return new ByteBufferImpl(baos.getRawBuffer(), 0, baos.size());
   }
View Full Code Here

      private final Transcoder<Object> transcoder = new SerializingTranscoder();

      @Override
      protected ByteBuffer objectToBuffer(Object o, int estimatedSize) {
         CachedData encoded = transcoder.encode(o);
         return new ByteBufferImpl(encoded.getData(), 0, encoded.getData().length);
      }
View Full Code Here

      private final Transcoder<Object> transcoder = new SerializingTranscoder();

      @Override
      protected ByteBuffer objectToBuffer(Object o, int estimatedSize) {
         CachedData encoded = transcoder.encode(o);
         return new ByteBufferImpl(encoded.getData(), 0, encoded.getData().length);
      }
View Full Code Here

TOP

Related Classes of org.infinispan.commons.io.ByteBufferImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.