Search in sources :

Example 1 with RevFeatureImpl

use of org.locationtech.geogig.api.RevFeatureImpl in project GeoGig by boundlessgeo.

the class FormatCommonV1 method readFeature.

public static RevFeature readFeature(ObjectId id, DataInput in) throws IOException {
    final int count = in.readInt();
    final ImmutableList.Builder<Optional<Object>> builder = ImmutableList.builder();
    for (int i = 0; i < count; i++) {
        final byte fieldTag = in.readByte();
        final FieldType fieldType = FieldType.valueOf(fieldTag);
        Object value = DataStreamValueSerializerV1.read(fieldType, in);
        builder.add(Optional.fromNullable(value));
    }
    return new RevFeatureImpl(id, builder.build());
}
Also used : Optional(com.google.common.base.Optional) ImmutableList(com.google.common.collect.ImmutableList) RevFeatureImpl(org.locationtech.geogig.api.RevFeatureImpl) RevObject(org.locationtech.geogig.api.RevObject) FieldType(org.locationtech.geogig.storage.FieldType)

Example 2 with RevFeatureImpl

use of org.locationtech.geogig.api.RevFeatureImpl in project GeoGig by boundlessgeo.

the class FormatCommonV2 method readFeature.

public static RevFeature readFeature(ObjectId id, DataInput in) throws IOException {
    final int count = readUnsignedVarInt(in);
    final ImmutableList.Builder<Optional<Object>> builder = ImmutableList.builder();
    for (int i = 0; i < count; i++) {
        final byte fieldTag = in.readByte();
        final FieldType fieldType = FieldType.valueOf(fieldTag);
        Object value = DataStreamValueSerializerV2.read(fieldType, in);
        builder.add(Optional.fromNullable(value));
    }
    return new RevFeatureImpl(id, builder.build());
}
Also used : Optional(com.google.common.base.Optional) ImmutableList(com.google.common.collect.ImmutableList) RevFeatureImpl(org.locationtech.geogig.api.RevFeatureImpl) RevObject(org.locationtech.geogig.api.RevObject) FieldType(org.locationtech.geogig.storage.FieldType)

Aggregations

Optional (com.google.common.base.Optional)2 ImmutableList (com.google.common.collect.ImmutableList)2 RevFeatureImpl (org.locationtech.geogig.api.RevFeatureImpl)2 RevObject (org.locationtech.geogig.api.RevObject)2 FieldType (org.locationtech.geogig.storage.FieldType)2