Package com.esotericsoftware.kryo

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


    Kryo kryo = new Kryo();
    ObjectBuffer buffer = new ObjectBuffer(kryo, 100000);
    List<DataProvider> providers = registerClasses(kryo);
    try {
      FileOutputStream fileOutputStream = new FileOutputStream(path);
      buffer.writeObject(fileOutputStream, providers);
      fileOutputStream.close();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here


   
    final Collection<? extends GrantedAuthority> authorities = Arrays.asList(new SimpleGrantedAuthority("foo"));
    final User user = new User("foo", "bar", authorities);
   
    final ObjectBuffer buffer = new ObjectBuffer(kryo, 100, 1024);
    final byte[] data = buffer.writeObject(user);
   
    final User user2 = buffer.readObject(data, User.class);
    TestUtils.assertDeepEquals(user, user2);
  }
}
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.