@Override public ObjectId read(DataInputStream in) throws IOException { return ObjectId.readFrom(in); } };
ObjectId readId(DataInput in) throws IOException { return ObjectId.readFrom(in); }
public final ObjectId readObjectId(DataInput in) throws IOException { return ObjectId.readFrom(in); }
public final static ObjectId readObjectId(DataInput in) throws IOException { return ObjectId.readFrom(in); }
@Nullable public ObjectId entryToObject(DataInput input) throws IOException { int size = input.readByte() & 0xFF; if (size == 0) { return ObjectId.NULL; } Preconditions.checkState(ObjectId.NUM_BYTES == size); return ObjectId.readFrom(input); }
@Nullable ObjectId readId(DataInputStream in) throws IOException { final int present = in.readByte() & 0xFF; Preconditions.checkArgument(present == 0 || present == 1); ObjectId id = null; if (1 == present) { id = ObjectId.readFrom(in); } return id; } }
public @Nullable ObjectId readId(DataInputStream in) throws IOException { ObjectId id = ObjectId.readFrom(in); return id.isNull() ? null : id; }
public static NodeRef readNodeRef(DataInput in) throws IOException { Node node = readNode(in); final ObjectId metadataId = ObjectId.readFrom(in); String parentPath = in.readUTF(); return new NodeRef(node, parentPath, metadataId); }
public static Node readNode(DataInput in) throws IOException { final String name = in.readUTF(); final ObjectId objectId = ObjectId.readFrom(in); final ObjectId metadataId = ObjectId.readFrom(in); final RevObject.TYPE contentType = RevObject.TYPE.valueOf(in.readByte()); final Envelope bbox = readBBox(in); Map<String, Object> extraData = DataStreamValueSerializerV1.INSTANCE.readMap(in); final Node node; node = RevObjectFactory.defaultInstance().createNode(name, objectId, metadataId, contentType, bbox, extraData); return node; }
public static RevCommit readCommit(ObjectId id, DataInput in) throws IOException { byte tag = in.readByte(); if (tag != COMMIT_TREE_REF) { throw new IllegalArgumentException("Commit should include a tree ref"); } final ObjectId treeId = ObjectId.readFrom(in); final Builder<ObjectId> parentListBuilder = ImmutableList.builder(); while (true) { tag = in.readByte(); if (tag != COMMIT_PARENT_REF) { break; } else { parentListBuilder.add(ObjectId.readFrom(in)); } } if (tag != COMMIT_AUTHOR_PREFIX) { throw new IllegalArgumentException( "Expected AUTHOR element following parent ids in commit"); } final RevPerson author = readRevPerson(in); tag = in.readByte(); if (tag != COMMIT_COMMITTER_PREFIX) { throw new IllegalArgumentException( "Expected COMMITTER element following author in commit"); } final RevPerson committer = readRevPerson(in); final String message = in.readUTF(); return RevObjectFactory.defaultInstance().createCommit(id, treeId, parentListBuilder.build(), author, committer, message); }
public static DAG deserialize(TreeId id, DataInput in) throws IOException { final ObjectId treeId = ObjectId.readFrom(in); final STATE state = STATE.values()[in.readByte() & 0xFF]; final long childCount = in.readLong(); final int childrenSize = in.readInt(); final int bucketSize = in.readShort(); Map<String, NodeId> children = ImmutableMap.of(); Set<TreeId> buckets = ImmutableSet.of(); if (childrenSize > 0) { children = new HashMap<>(); for (int i = 0; i < childrenSize; i++) { NodeId nid = DAGSerializer.read(in); children.put(nid.name(), nid); } } if (bucketSize > 0) { buckets = new HashSet<>(); for (int i = 0; i < bucketSize; i++) { final int len = in.readShort(); final byte[] bucketIndicesByDepth = new byte[len]; in.readFully(bucketIndicesByDepth); buckets.add(new TreeId(bucketIndicesByDepth)); } } return new DAG(id, treeId, childCount, state, children, buckets); }
public static final Bucket readBucket(int index, DataInput in) throws IOException { ObjectId objectId = ObjectId.readFrom(in); Envelope bounds = readBBox(in); return RevObjectFactory.defaultInstance().createBucket(objectId, index, bounds); }
public ImmutableSortedMap<Integer, Bucket> build() { int off = offset + HEADER_SIZE; Builder<Integer, Bucket> builder = ImmutableSortedMap.naturalOrder(); DataInput in = data.asDataInput(off); try { int index; ObjectId id; double minx, maxx, miny, maxy; Envelope bounds; for (int i = 0; i < size; i++) { index = in.readUnsignedByte(); id = ObjectId.readFrom(in); minx = in.readDouble(); if (Double.isNaN(minx)) { bounds = null; } else { maxx = in.readDouble(); miny = in.readDouble(); maxy = in.readDouble(); bounds = new Envelope(minx, maxx, miny, maxy); } Bucket bucket = RevObjectFactory.defaultInstance().createBucket(id, index, bounds); builder.put(Integer.valueOf(index), bucket); } } catch (IOException e) { throw new RuntimeException(e); } return builder.build(); }
public static DAG deserialize(TreeId id, DataInput in) throws IOException { final ObjectId treeId = ObjectId.readFrom(in); final STATE state = STATE.values()[in.readByte() & 0xFF]; final long childCount = Varint.readUnsignedVarLong(in); final int childrenSize = Varint.readUnsignedVarInt(in); final int bucketSize = Varint.readUnsignedVarInt(in); Set<NodeId> children = ImmutableSet.of(); Set<TreeId> buckets = ImmutableSet.of(); if (childrenSize > 0) { children = new HashSet<>(); for (int i = 0; i < childrenSize; i++) { NodeId nid = NodeId.read(in); children.add(nid); } } if (bucketSize > 0) { buckets = new HashSet<>(); for (int i = 0; i < bucketSize; i++) { final int len = Varint.readUnsignedVarInt(in); final byte[] bucketIndicesByDepth = new byte[len]; in.readFully(bucketIndicesByDepth); buckets.add(new TreeId(bucketIndicesByDepth)); } } DAG dag = new DAG(id, treeId, childCount, state, children, buckets); return dag; }