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

The following examples show how to use org.apache.tinkerpop.shaded.kryo.io.Input#readString() . 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: AbstractGryoClassResolver.java    From tinkerpop with Apache License 2.0 6 votes vote down vote up
protected Registration readName(final Input input) {
    final int nameId = input.readVarInt(true);
    if (nameIdToClass == null) nameIdToClass = new IntMap<>();
    Class type = nameIdToClass.get(nameId);
    if (type == null) {
        // Only read the class name the first time encountered in object graph.
        final String className = input.readString();
        type = getTypeByName(className);
        if (type == null) {
            try {
                type = Class.forName(className, false, kryo.getClassLoader());
            } catch (ClassNotFoundException ex) {
                throw new KryoException("Unable to find class: " + className, ex);
            }
            if (nameToClass == null) nameToClass = new ObjectMap<>();
            nameToClass.put(className, type);
        }
        nameIdToClass.put(nameId, type);
    }
    return kryo.getRegistration(type);
}
 
Example 2
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 3
Source File: JsonBuilderGryoSerializer.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
@Override
public JsonBuilder read(final Kryo kryo, final Input input, final Class<JsonBuilder> jsonBuilderClass) {
    final String jsonString = input.readString();
    return new JsonBuilder(slurper.parseText(jsonString));
}