package net.openhft.chronicle.wire;
import net.openhft.chronicle.core.pool.ClassAliasPool;
import static net.openhft.chronicle.bytes.Bytes.allocateElasticOnHeap;
public class WireExamples {
public static class Car implements Marshallable {
private int number;
private String driver;
public Car(String driver, int number) {
this.driver = driver;
this.number = number;
}
}
public static void main(String... args) {
// allows the the YAML to refer to car, rather than net.openhft.chronicle.wire.WireExamples$Car
ClassAliasPool.CLASS_ALIASES.addAlias(Car.class);
Wire wire = new YamlWire(allocateElasticOnHeap());
wire.getValueOut().object(new Car("Lewis Hamilton", 44));
System.out.println(wire);
}
}
|