Package com.esotericsoftware.kryo

Examples of com.esotericsoftware.kryo.Kryo


public class RmiTest extends KryoNetTestCase {
  /** In this test both the client and server have an ObjectSpace that contains a TestObject. When the client connects, the same
   * test is run on both the client and server. The test excersizes a number of remote method calls and other features. */
  public void testRMI () throws IOException {
    Server server = new Server();
    Kryo serverKryo = server.getKryo();
    register(serverKryo);

    startEndPoint(server);
    server.bind(tcpPort, udpPort);

View Full Code Here


    waitForThreads();
  }

  public void testMany () throws IOException {
    Server server = new Server();
    Kryo serverKryo = server.getKryo();
    register(serverKryo);

    startEndPoint(server);
    server.bind(tcpPort);
View Full Code Here

public class RmiSendObjectTest extends KryoNetTestCase {
  /** In this test the server has two objects in an object space. The client uses the first remote object to get the second remote
   * object. */
  public void testRMI () throws IOException {
    Server server = new Server();
    Kryo serverKryo = server.getKryo();
    register(serverKryo);

    // After all common registrations, register OtherObjectImpl only on the server using the remote object interface ID.
    // This causes OtherObjectImpl to be serialized as OtherObject.
    int otherObjectID = serverKryo.getRegistration(OtherObject.class).getId();
    serverKryo.register(OtherObjectImpl.class, new RemoteObjectSerializer(), otherObjectID);

    startEndPoint(server);
    server.bind(tcpPort);

    // TestObjectImpl has a reference to an OtherObjectImpl.
View Full Code Here

  public KryoTranscoder() {
    this(Thread.currentThread().getContextClassLoader());
  }

  public KryoTranscoder(ClassLoader cl) {
    kryo = new Kryo();
    kryo.setRegistrationRequired(false);
    kryo.setClassLoader(cl);
  }
View Full Code Here

  private final byte[] buffer = new byte[BUFFER_SIZE];
  private final Output output = new Output(buffer, -1);
  private final Input input = new Input(buffer);

  public KryoSerializer(Class<?> clazz) {
    kryo = new Kryo();
    kryo.setReferences(false);
    kryo.register(clazz);
    this.clazz = clazz;
  }
View Full Code Here

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
        final Server server = new Server();
        Kryo kryo = server.getKryo();
        kryo.register(Packet.class);
       
        server.start();
        server.bind(12_345);
       
        final Client client = new Client();
        kryo = client.getKryo();
        kryo.register(Packet.class);       
       
        client.start();
        client.connect(5_000, "localhost", 12_345);       
       
        client.addListener(new Listener() {
View Full Code Here

    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

  Client client;
  static NetGetBiomeDataResult currentResults = null;
 
  public RemoteMinecraft(String address) {
    client = new Client(65536, 65536);
    Kryo kryo = client.getKryo();
    kryo.register(NetCreateWorldRequest.class);
    kryo.register(NetGetBiomeDataRequest.class);
    kryo.register(NetGetBiomeDataResult.class);
    kryo.register(NetBiome.class);
    kryo.register(NetBiome[].class);
    kryo.register(NetInfoRequest.class);
    kryo.register(int[].class);
   
    client.addListener(new Listener() {
      @Override
      public void received(Connection connection, Object object) {
        if (object instanceof NetGetBiomeDataResult) {
View Full Code Here

* Factory to create Kryo instances customized for managing NodeDocument
*/
public class KryoFactory {

    public static Kryo createInstance(DocumentStore documentStore) {
        Kryo kryo = new Kryo();
        kryo.setReferences(false);
        kryo.register(Revision.class, new Serializers.RevisionSerizlizer());
        kryo.register(NodeDocument.class, new Serializers.NodeDocumentSerializer(documentStore));
        kryo.register(NavigableMap.class);

        //All the required classes need to be registered explicitly
        kryo.setRegistrationRequired(true);
        return 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.