public <T> T deserialize(final InputStream stream, final int bufferSize) {
    ByteBufferInput in = new ByteBufferInput(stream, bufferSize);
    Kryo kryo = borrow();
    try {
      @SuppressWarnings("unchecked")
      T obj = (T) kryo.readClassAndObject(in);
      return obj;
    } finally {
      release(kryo);
    }
  }
public < T > T deserialize ( final InputStream stream , final int bufferSize ) { ByteBufferInput in = new ByteBufferInput ( stream , bufferSize ) ; Kryo kryo = borrow ( ) ; try { @ SuppressWarnings ( "unchecked" ) T obj = ( T ) kryo . readClassAndObject ( in ) ; return obj ; } finally { release ( kryo ) ; } }
Deserializes given InputStream to an Object using Kryo instance in pool.

@param stream     input stream
@param <T>        deserialized Object type
@param bufferSize size of the buffer in front of the stream
@return deserialized Object