Search in sources :

Example 1 with Output

use of org.apache.tinkerpop.shaded.kryo.io.Output in project janusgraph by JanusGraph.

the class JanusGraphIoRegistryTest method testLegacyGeoshapAsGryo.

@Test
public void testLegacyGeoshapAsGryo() {
    final Geoshape point = Geoshape.point(1.0d, 4.0d);
    Kryo kryo = new Kryo();
    ByteArrayOutputStream outStream = new ByteArrayOutputStream();
    Output output = new Output(outStream, 4096);
    output.writeLong(1);
    output.writeFloat((float) point.getPoint().getLatitude());
    output.writeFloat((float) point.getPoint().getLongitude());
    output.flush();
    Geoshape.GeoShapeGryoSerializer serializer = new Geoshape.GeoShapeGryoSerializer();
    Input input = new Input(new ByteArrayInputStream(outStream.toByteArray()), 4096);
    assertEquals(point, serializer.read(kryo, input, Geoshape.class));
}
Also used : Input(org.apache.tinkerpop.shaded.kryo.io.Input) ByteArrayInputStream(java.io.ByteArrayInputStream) Output(org.apache.tinkerpop.shaded.kryo.io.Output) Geoshape(org.janusgraph.core.attribute.Geoshape) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Kryo(org.apache.tinkerpop.shaded.kryo.Kryo) Test(org.junit.Test)

Aggregations

ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 Kryo (org.apache.tinkerpop.shaded.kryo.Kryo)1 Input (org.apache.tinkerpop.shaded.kryo.io.Input)1 Output (org.apache.tinkerpop.shaded.kryo.io.Output)1 Geoshape (org.janusgraph.core.attribute.Geoshape)1 Test (org.junit.Test)1