Examples of readClassAndObject()


Examples of com.esotericsoftware.kryo.Kryo.readClassAndObject()

    Kryo kryo = new Kryo();
    Input input = new Input(new ByteBufferInputStream(b));
    input.setPosition(MonitoringDataStorage.FIRST_RECORD_POSITION);
    assertEquals("blabla1",((MonitoringDataDummy)kryo.readClassAndObject(input)).value);
    assertEquals("blabla2",((MonitoringDataDummy)kryo.readClassAndObject(input)).value);
    assertNull(kryo.readClassAndObject(input));
    b.putInt(MonitoringDataStorage.LIMIT_POSITION, b.position());
    b.position(0);
    ranAccess.close();
    }
   
View Full Code Here

Examples of com.esotericsoftware.kryo.Kryo.readClassAndObject()

      kryo.writeClassAndObject(output, object);
      kryo.writeClassAndObject(output, new LogEvent());
      assertTrue(output.getBuffer().length>0);
     
      Input input = new Input(output.getBuffer());
      assertEquals(AdapterWfLaunchInfo.class, kryo.readClassAndObject(input).getClass());
      assertEquals(LogEvent.class, kryo.readClassAndObject(input).getClass());
    }
  }
 
  @Test
View Full Code Here

Examples of com.esotericsoftware.kryo.Kryo.readClassAndObject()

      kryo.writeClassAndObject(output, new LogEvent());
      assertTrue(output.getBuffer().length>0);
     
      Input input = new Input(output.getBuffer());
      assertEquals(AdapterWfLaunchInfo.class, kryo.readClassAndObject(input).getClass());
      assertEquals(LogEvent.class, kryo.readClassAndObject(input).getClass());
    }
  }
 
  @Test
  public void test_add(){
View Full Code Here

Examples of com.esotericsoftware.kryo.Kryo.readClassAndObject()

   public Object createObjectFromBytes(byte[] bytes) {
      Kryo kryo = getCurrentThreadKryo();
     
      Object obj = null;
      Input in = new Input(bytes);
      obj = (Object) kryo.readClassAndObject(in);
      in.close();
      return obj;
   }

   @Override
View Full Code Here

Examples of com.esotericsoftware.kryo.Kryo.readClassAndObject()

     
      // skip the buffer length parameter
      buffer.position(buffer.position() + 4);
     
      Input in = new Input(new ByteBufferInputStream(buffer));
      Message msg = (Message) kryo.readClassAndObject(in);
      in.close();
      msg.rewind();
      return msg;
   }
View Full Code Here

Examples of com.esotericsoftware.kryo.Kryo.readClassAndObject()

    private Object decode(ByteBuffer bytes) {
        Kryo kryo = null;
        try {
            kryo = kryoPool.get();
            return kryo.readClassAndObject(new Input(new ByteArrayInputStream(bytes.array(), bytes
                    .arrayOffset() + bytes.position(), bytes.limit())));
        } catch (Exception e) {
            if (e instanceof RuntimeException) {
                throw (RuntimeException) e;
            }
View Full Code Here

Examples of com.esotericsoftware.kryo.Kryo.readClassAndObject()

    Output output = new ByteBufferOutput(buffer);
    Input input = new ByteBufferInput(buffer);
    Class<? extends Serializer> serializer = entryType.getAnnotation(EntryType.class).serializer();
    kryo.register(entryType, serializer.newInstance(), entryType.getAnnotation(EntryType.class) .id());
    kryo.writeClassAndObject(output, entry);
    T result = (T) kryo.readClassAndObject(input);
    Assert.assertEquals(entry, result);
  }

}
View Full Code Here

Examples of com.esotericsoftware.kryo.ObjectBuffer.readClassAndObject()

    }

    @Override
    public Object deserialize(byte[] rawMessage) {
        ObjectBuffer buffer = new ObjectBuffer(kryo, initialBufferSize, maxBufferSize);
        return buffer.readClassAndObject(rawMessage);
    }

    @Override
    public byte[] serialize(Object message) {
        ObjectBuffer buffer = new ObjectBuffer(kryo, initialBufferSize, maxBufferSize);
View Full Code Here

Examples of com.esotericsoftware.kryo.ObjectBuffer.readClassAndObject()

    }

    public static Object unserializeKryo(final Kryo kryo, final byte[] bytes) {
        try {
            final ObjectBuffer buffer = new ObjectBuffer(kryo, BUFFERS_INITIAL_CAPACITY, BUFFERS_MAXIMAL_CAPACITY);
            return buffer.readClassAndObject(bytes);
        } catch (final SerializationException e) {
            logger.error("unserialize exception with Kryo", e);
        }
        return null;
    }
View Full Code Here

Examples of com.esotericsoftware.kryo.ObjectBuffer.readClassAndObject()

    }

    @Override
    public Object deserialize(byte[] rawMessage) {
        ObjectBuffer buffer = new ObjectBuffer(kryo, initialBufferSize, maxBufferSize);
        return buffer.readClassAndObject(rawMessage);
    }

    @Override
    public byte[] serialize(Object message) {
        ObjectBuffer buffer = new ObjectBuffer(kryo, initialBufferSize, maxBufferSize);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.