Java Code Examples for org.apache.tinkerpop.shaded.kryo.io.Input#readInt()

The following examples show how to use org.apache.tinkerpop.shaded.kryo.io.Input#readInt() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RecordId.java    From sqlg with MIT License 6 votes vote down vote up
@Override
public void read(Kryo kryo, Input input) {
    this.schemaTable = SchemaTable.of(input.readString(), input.readString());
    String s = input.readString();
    if (s.equals("s")) {
        //sequence
        this.id = ID.from(input.readLong());
    } else {
        int size = input.readInt();
        List<Comparable> identifiers = new ArrayList<>();
        for (int i = 0; i < size; i++) {
            String identifier = input.readString();
            identifiers.add(identifier);
        }
        this.id = ID.from(identifiers);
    }
}
 
Example 2
Source File: HugeGryoModule.java    From hugegraph with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unused")
private static Map<HugeKeys, Object> readEntry(Kryo kryo, Input input) {
    int columnSize = input.readInt();
    Map<HugeKeys, Object> map = new LinkedHashMap<>();
    for (int i = 0; i < columnSize; i++) {
        HugeKeys key = kryo.readObject(input, HugeKeys.class);
        Object val = kryo.readClassAndObject(input);
        map.put(key, val);
    }
    return map;
}
 
Example 3
Source File: TinkerIoRegistryV1d0.java    From tinkergraph-gremlin with Apache License 2.0 5 votes vote down vote up
@Override
public TinkerGraph read(final Kryo kryo, final Input input, final Class<TinkerGraph> tinkerGraphClass) {
    final Configuration conf = new BaseConfiguration();
    conf.setProperty("gremlin.tinkergraph.defaultVertexPropertyCardinality", "list");
    final TinkerGraph graph = TinkerGraph.open(conf);
    final int len = input.readInt();
    final byte[] bytes = input.readBytes(len);
    try (final ByteArrayInputStream stream = new ByteArrayInputStream(bytes)) {
        GryoReader.build().mapper(() -> kryo).create().readGraph(stream, graph);
    } catch (Exception io) {
        throw new RuntimeException(io);
    }

    return graph;
}
 
Example 4
Source File: TinkerIoRegistryV3d0.java    From tinkergraph-gremlin with Apache License 2.0 5 votes vote down vote up
@Override
public TinkerGraph read(final Kryo kryo, final Input input, final Class<TinkerGraph> tinkerGraphClass) {
    final Configuration conf = new BaseConfiguration();
    conf.setProperty("gremlin.tinkergraph.defaultVertexPropertyCardinality", "list");
    final TinkerGraph graph = TinkerGraph.open(conf);
    final int len = input.readInt();
    final byte[] bytes = input.readBytes(len);
    try (final ByteArrayInputStream stream = new ByteArrayInputStream(bytes)) {
        GryoReader.build().mapper(() -> kryo).create().readGraph(stream, graph);
    } catch (Exception io) {
        throw new RuntimeException(io);
    }

    return graph;
}
 
Example 5
Source File: TinkerIoRegistryV2d0.java    From tinkergraph-gremlin with Apache License 2.0 5 votes vote down vote up
@Override
public TinkerGraph read(final Kryo kryo, final Input input, final Class<TinkerGraph> tinkerGraphClass) {
    final Configuration conf = new BaseConfiguration();
    conf.setProperty("gremlin.tinkergraph.defaultVertexPropertyCardinality", "list");
    final TinkerGraph graph = TinkerGraph.open(conf);
    final int len = input.readInt();
    final byte[] bytes = input.readBytes(len);
    try (final ByteArrayInputStream stream = new ByteArrayInputStream(bytes)) {
        GryoReader.build().mapper(() -> kryo).create().readGraph(stream, graph);
    } catch (Exception io) {
        throw new RuntimeException(io);
    }

    return graph;
}
 
Example 6
Source File: TinkerIoRegistryV1d0.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
@Override
public TinkerGraph read(final Kryo kryo, final Input input, final Class<TinkerGraph> tinkerGraphClass) {
    final Configuration conf = new BaseConfiguration();
    conf.setProperty("gremlin.tinkergraph.defaultVertexPropertyCardinality", "list");
    final TinkerGraph graph = TinkerGraph.open(conf);
    final int len = input.readInt();
    final byte[] bytes = input.readBytes(len);
    try (final ByteArrayInputStream stream = new ByteArrayInputStream(bytes)) {
        GryoReader.build().mapper(() -> kryo).create().readGraph(stream, graph);
    } catch (Exception io) {
        throw new RuntimeException(io);
    }

    return graph;
}
 
Example 7
Source File: TinkerIoRegistryV3d0.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
@Override
public TinkerGraph read(final Kryo kryo, final Input input, final Class<TinkerGraph> tinkerGraphClass) {
    final Configuration conf = new BaseConfiguration();
    conf.setProperty("gremlin.tinkergraph.defaultVertexPropertyCardinality", "list");
    final TinkerGraph graph = TinkerGraph.open(conf);
    final int len = input.readInt();
    final byte[] bytes = input.readBytes(len);
    try (final ByteArrayInputStream stream = new ByteArrayInputStream(bytes)) {
        GryoReader.build().mapper(() -> kryo).create().readGraph(stream, graph);
    } catch (Exception io) {
        throw new RuntimeException(io);
    }

    return graph;
}
 
Example 8
Source File: TinkerIoRegistryV2d0.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
@Override
public TinkerGraph read(final Kryo kryo, final Input input, final Class<TinkerGraph> tinkerGraphClass) {
    final Configuration conf = new BaseConfiguration();
    conf.setProperty("gremlin.tinkergraph.defaultVertexPropertyCardinality", "list");
    final TinkerGraph graph = TinkerGraph.open(conf);
    final int len = input.readInt();
    final byte[] bytes = input.readBytes(len);
    try (final ByteArrayInputStream stream = new ByteArrayInputStream(bytes)) {
        GryoReader.build().mapper(() -> kryo).create().readGraph(stream, graph);
    } catch (Exception io) {
        throw new RuntimeException(io);
    }

    return graph;
}