use of org.nustaq.serialization.FSTObjectInput in project chuidiang-ejemplos by chuidiang.
the class FstExample method main.
public static void main(String[] args) throws Exception {
FSTConfiguration conf = FSTConfiguration.createDefaultConfiguration();
SomeMediumClass mediumClass = new SomeMediumClass();
byte[] barray = conf.asByteArray(mediumClass);
System.out.println(barray.length);
SomeMediumClass object = (SomeMediumClass) conf.asObject(barray);
System.out.println(object);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
FSTObjectOutput output = new FSTObjectOutput(outputStream);
output.writeObject(mediumClass);
output.close();
FSTObjectInput input = new FSTObjectInput(new ByteArrayInputStream(outputStream.toByteArray()));
object = (SomeMediumClass) input.readObject(SomeMediumClass.class);
System.out.println(object);
}
Aggregations