/** * Reads a bucket body (i.e assumes the head unsigned int "index" has been read already) */ protected Bucket readBucketBody(DataInput in) throws IOException { ObjectId objectId = readObjectId(in); final int boundsMask = in.readByte() & 0xFF; @Nullable final Envelope bounds; if (BOUNDS_POINT_MASK == boundsMask) { bounds = readPointBoundingBox(in); } else if (BOUNDS_BOX2D_MASK == boundsMask) { bounds = readBoundingBox(in); } else { bounds = null; } return Bucket.create(objectId, bounds); }
@Override public RevCommit readBody(@Nullable ObjectId id, DataInput in) throws IOException { return format.readCommit(id, in); }
@Override public RevFeature readBody(@Nullable ObjectId id, DataInput in) throws IOException { return format.readFeature(id, in); }
public NodeRef readNodeRef(DataInput in) throws IOException { Node node = readNode(in); final ObjectId metadataId = readObjectId(in); String parentPath = in.readUTF(); return new NodeRef(node, parentPath, metadataId); }
public RevFeatureType readFeatureType(@Nullable ObjectId id, DataInput in, FeatureTypeFactory typeFactory) throws IOException { Name name = readName(in); int propertyCount = readUnsignedVarInt(in); List<AttributeDescriptor> attributes = new ArrayList<AttributeDescriptor>(); for (int i = 0; i < propertyCount; i++) { attributes.add(readAttributeDescriptor(in, typeFactory)); } SimpleFeatureType ftype = typeFactory.createSimpleFeatureType(name, attributes, null, false, Collections.<Filter> emptyList(), BasicFeatureTypes.FEATURE, null); RevFeatureType revtype; if (id == null) { revtype = RevFeatureTypeBuilder.build(ftype); } else { revtype = RevFeatureTypeBuilder.create(id, ftype); } return revtype; }
private static AttributeDescriptor readAttributeDescriptor(DataInput in, FeatureTypeFactory typeFactory) throws IOException { final Name name = readName(in); final boolean nillable = in.readBoolean(); final int minOccurs = in.readInt(); final int maxOccurs = in.readInt(); final AttributeType type = readAttributeType(in, typeFactory); if (type instanceof GeometryType) return typeFactory.createGeometryDescriptor((GeometryType) type, name, minOccurs, maxOccurs, nillable, null); else return typeFactory.createAttributeDescriptor(type, name, minOccurs, maxOccurs, nillable, null); }
Node n = readNode(in); checkState(RevObject.TYPE.FEATURE.equals(n.getType()), "Non-feature node in tree's feature list."); Node n = readNode(in); checkState(RevObject.TYPE.TREE.equals(n.getType()), "Non-tree node in tree's subtree list %s->%s.", n.getType(), n); Bucket bucket = readBucketBody(in); buckets.put(Integer.valueOf(bucketIndex), bucket);
@Override public RevFeatureType readBody(@Nullable ObjectId id, DataInput in) throws IOException { return format.readFeatureType(id, in); }
private RevObject readInternal(@Nullable ObjectId id, DataInput in) throws IOException { final TYPE type = format.readHeader(in); Serializer<RevObject> serializer = serializer(type); RevObject object = serializer.readBody(id, in); return object; }
private static AttributeType readAttributeType(DataInput in, FeatureTypeFactory typeFactory) throws IOException { final Name name = readName(in); final byte typeTag = in.readByte(); final FieldType type = FieldType.valueOf(typeTag); if (Geometry.class.isAssignableFrom(type.getBinding())) { final boolean isCRSCode = in.readBoolean(); // as opposed to a raw WKT string final String crsText = in.readUTF(); final CoordinateReferenceSystem crs; try { if (isCRSCode) { if (RevObjects.NULL_CRS_IDENTIFIER.equals(crsText)) { crs = null; } else { boolean forceLongitudeFirst = crsText.startsWith("EPSG:"); crs = CRS.decode(crsText, forceLongitudeFirst); } } else { crs = CRS.parseWKT(crsText); } } catch (FactoryException e) { throw new RuntimeException(e); } return typeFactory.createGeometryType(name, type.getBinding(), crs, false, false, Collections.<Filter> emptyList(), null, null); } else { return typeFactory.createAttributeType(name, type.getBinding(), false, false, Collections.<Filter> emptyList(), null, null); } }
public RevFeatureType readFeatureType(@Nullable ObjectId id, DataInput in, FeatureTypeFactory typeFactory) throws IOException { Name name = readName(in); int propertyCount = readUnsignedVarInt(in); List<AttributeDescriptor> attributes = new ArrayList<AttributeDescriptor>(); for (int i = 0; i < propertyCount; i++) { attributes.add(readAttributeDescriptor(in, typeFactory)); } SimpleFeatureType ftype = typeFactory.createSimpleFeatureType(name, attributes, null, false, Collections.<Filter> emptyList(), BasicFeatureTypes.FEATURE, null); return RevFeatureType.builder().id(id).type(ftype).build(); }
public NodeRef readNodeRef(DataInput in) throws IOException { Node node = readNode(in); final ObjectId metadataId = readObjectId(in); String parentPath = in.readUTF(); return new NodeRef(node, parentPath, metadataId); }
private static AttributeDescriptor readAttributeDescriptor(DataInput in, FeatureTypeFactory typeFactory) throws IOException { final Name name = readName(in); final boolean nillable = in.readBoolean(); final int minOccurs = in.readInt(); final int maxOccurs = in.readInt(); final AttributeType type = readAttributeType(in, typeFactory); if (type instanceof GeometryType) return typeFactory.createGeometryDescriptor((GeometryType) type, name, minOccurs, maxOccurs, nillable, null); else return typeFactory.createAttributeDescriptor(type, name, minOccurs, maxOccurs, nillable, null); }
Node n = readNode(in); checkState(RevObject.TYPE.FEATURE.equals(n.getType()), "Non-feature node in tree's feature list."); Node n = readNode(in); checkState(RevObject.TYPE.TREE.equals(n.getType()), "Non-tree node in tree's subtree list %s->%s.", n.getType(), n); for (int i = 0; i < nBuckets; i++) { int bucketIndex = readUnsignedVarInt(in); Bucket bucket = readBucketBody(bucketIndex, in); buckets.add(bucket);
public RevFeatureType readFeatureType(@Nullable ObjectId id, DataInput in) throws IOException { return readFeatureType(id, in, DEFAULT_FEATURETYPE_FACTORY); }
private RevObject readInternal(@Nullable ObjectId id, DataInput in) throws IOException { final TYPE type = format.readHeader(in); Serializer<RevObject> serializer = serializer(type); RevObject object = serializer.readBody(id, in); return object; }
private static AttributeType readAttributeType(DataInput in, FeatureTypeFactory typeFactory) throws IOException { final Name name = readName(in); final byte typeTag = in.readByte(); final FieldType type = FieldType.valueOf(typeTag); if (Geometry.class.isAssignableFrom(type.getBinding())) { final boolean isCRSCode = in.readBoolean(); // as opposed to a raw WKT string final String crsText = in.readUTF(); final CoordinateReferenceSystem crs; try { if (isCRSCode) { if (RevObjects.NULL_CRS_IDENTIFIER.equals(crsText)) { crs = null; } else { boolean forceLongitudeFirst = crsText.startsWith("EPSG:"); crs = CRS.decode(crsText, forceLongitudeFirst); } } else { crs = CRS.parseWKT(crsText); } } catch (FactoryException e) { throw new RuntimeException(e); } return typeFactory.createGeometryType(name, type.getBinding(), crs, false, false, Collections.<Filter> emptyList(), null, null); } else { return typeFactory.createAttributeType(name, type.getBinding(), false, false, Collections.<Filter> emptyList(), null, null); } }
/** * Reads a bucket body (i.e assumes the head unsigned int "index" has been read already) * * @param bucketIndex */ protected Bucket readBucketBody(int bucketIndex, DataInput in) throws IOException { ObjectId objectId = readObjectId(in); final int boundsMask = in.readByte() & 0xFF; @Nullable final Envelope bounds; if (BOUNDS_POINT_MASK == boundsMask) { bounds = readPointBoundingBox(in); } else if (BOUNDS_BOX2D_MASK == boundsMask) { bounds = readBoundingBox(in); } else { bounds = null; } return RevObjectFactory.defaultInstance().createBucket(objectId, bucketIndex, bounds); }
@Override public RevFeatureType readBody(@Nullable ObjectId id, DataInput in) throws IOException { return format.readFeatureType(id, in); }
@Override public RevFeature readBody(@Nullable ObjectId id, DataInput in) throws IOException { return format.readFeature(id, in); }