Package com.esotericsoftware.kryo

Examples of com.esotericsoftware.kryo.Kryo


    return buffer.toString();
  }

  public String toKryo() {
    Output out = new Output(4 * 1024, 10 * 1024 * 1024);
    new Kryo().writeObject(out, this);
    out.close();
    return Base64.encodeBase64String(out.toBytes());
  }
View Full Code Here


    return Base64.encodeBase64String(out.toBytes());
  }

  static SearchArgument fromKryo(String value) {
    Input input = new Input(Base64.decodeBase64(value));
    return new Kryo().readObject(input, SearchArgumentImpl.class);
  }
View Full Code Here

  @Test(dataProvider = "entryProvider")
  @SuppressWarnings({"rawtypes"})
  public <T extends Entry> void testSerializeAndDeserializeEntry(Class<T> entryType, T entry)
    throws Exception {
    Kryo kryo = new Kryo();
    ByteBuffer buffer = ByteBuffer.allocate(4096);
    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

  private final Class<? extends Entry> entryType;
  protected final Kryo kryo;

  protected BaseLog(Class<? extends Entry> entryType) {
    this.entryType = entryType;
    this.kryo = new Kryo();
    init();
  }
View Full Code Here

  private final Kryo kryo;
  private final ByteBufferInput input;
  private final ByteBufferOutput output;

  public KryoSerialization () {
    this(new Kryo());
    kryo.setReferences(false);
    kryo.setRegistrationRequired(true);
  }
View Full Code Here

*
* @author pron
*/
public final class KryoUtil {
    public static Kryo newKryo() {
        Kryo kryo = new ReplaceableObjectKryo();

        kryo.setRegistrationRequired(false);
        kryo.setInstantiatorStrategy(new SerializingInstantiatorStrategy());
        registerCommonClasses(kryo);
        return kryo;
    }
View Full Code Here

* @author Jon Brisbin
*/
public class KryoCodec<IN, OUT> extends SerializationCodec<Kryo, IN, OUT> {

  public KryoCodec() {
    super(new Kryo(), true);
  }
View Full Code Here

  CountDownLatch latch;

  @BeforeClass
  public static void classSetup() {
    KRYO = new Kryo();
    KRYO_CODEC = new KryoCodec<>(KRYO, false);
    ZMQ = new ZeroMQ<Data>(new Environment()).codec(KRYO_CODEC);
  }
View Full Code Here

  }


  @Override
  protected synchronized Kryo getKryoInstance() {
    Kryo kryo = new Kryo();
    kryo.setInstantiatorStrategy(new StdInstantiatorStrategy());
    return kryo;
  }
View Full Code Here

  public T deserialize(byte[] bytes) throws IOException {
    return deserialize(new ByteArrayInputStream(bytes));
  }

  protected Kryo getKryoInstance() {
    return new Kryo();
  }
View Full Code Here

TOP

Related Classes of com.esotericsoftware.kryo.Kryo

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.