Examples of writeClassAndObject()


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

    {
      Output output = new Output(1024);
      final AdapterWfLaunchInfo object = new AdapterWfLaunchInfo();
      object.setAdapterName("abc");
      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());
View Full Code Here

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

     
      byte[] bytes = null;
      ByteArrayOutputStream bos = new ByteArrayOutputStream();
      Output out = new Output(bos);
      try {
         kryo.writeClassAndObject(out, m);
         out.flush();
         bytes = bos.toByteArray();
         bos.close();
      } catch (IOException e) {
         e.printStackTrace();
View Full Code Here

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

        Kryo kryo = null;
        try {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            Output output = new Output(baos);
            kryo = kryoPool.get();
            kryo.writeClassAndObject(output, value);
            output.close();
            return baos.toByteArray();
        } catch (Exception e) {
            if (e instanceof RuntimeException) {
                throw (RuntimeException) e;
View Full Code Here

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

    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

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

     
      public static byte[] ser(SolrInputDocument doc)
      {
        synchronized (buffer) {
          ObjectBuffer buffer=new ObjectBuffer(KROY);
          return buffer.writeClassAndObject(doc);
        }
      }
     
      public static SolrInputDocument dec(byte[] buff)
      {
View Full Code Here

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

    }

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

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

    }

    public static byte[] serializeKryo(final Kryo kryo, final Object object) {
        final ObjectBuffer buffer = new ObjectBuffer(kryo, BUFFERS_INITIAL_CAPACITY, BUFFERS_MAXIMAL_CAPACITY);
        try {
            return buffer.writeClassAndObject(object);
        } catch (final SerializationException e) {
            logger.error("serialize exception with Kryo on object : {}", object, e);
        }
        return null;
    }
View Full Code Here

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

    }

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

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

    }

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

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

    }

    @Override
    public byte[] serialize(Object message) {
        ObjectBuffer buffer = new ObjectBuffer(kryo, initialBufferSize, maxBufferSize);
        return buffer.writeClassAndObject(message);
    }
}
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.