@Override public void write(DataOutputStream out, ObjectId value) throws IOException { value.writeTo(out); }
void write(DataOutput out, ObjectId value) throws IOException { value.writeTo(out); }
public void writeId(ObjectId id, DataOutputStream out) throws IOException { id.writeTo(out); }
void writeId(DataOutputStream out, @Nullable ObjectId id) throws IOException { out.writeByte(id == null ? 0 : 1); if (id != null) { id.writeTo(out); } }
public void objectToEntry(@Nullable ObjectId object, DataOutput output) throws IOException { if (null == object || object.isNull()) { output.writeByte(0); } else { output.writeByte(ObjectId.NUM_BYTES); object.writeTo(output); } } }
private static int objectIdIndex(ObjectId objectId, Index<ObjectId> uniqueIds, InternalDataOutput objectIds) throws IOException { final boolean exists = -1 != uniqueIds.indexOf(objectId); final int oidIdx = uniqueIds.getOrAdd(objectId); if (!exists) { objectId.writeTo(objectIds); } return oidIdx; }
private static int objectIdIndex(ObjectId objectId, Index<ObjectId> uniqueIds, InternalDataOutput objectIds) throws IOException { final boolean exists = -1 != uniqueIds.indexOf(objectId); final int oidIdx = uniqueIds.getOrAdd(objectId); if (!exists) { objectId.writeTo(objectIds); } return oidIdx; }
public static void writeBucket(int index, Bucket bucket, DataOutput data, Envelope envBuff) { try { data.writeInt(index); bucket.getObjectId().writeTo(data); envBuff.setToNull(); bucket.expand(envBuff); writeBoundingBox(envBuff, data); } catch (IOException e) { throw new RuntimeException(e); } }
public void writeTag(RevTag tag, DataOutput out) throws IOException { tag.getCommitId().writeTo(out); out.writeUTF(tag.getName()); out.writeUTF(tag.getMessage()); writePerson(tag.getTagger(), out); }
@Override public void write(RevCommit commit, OutputStream out) throws IOException { DataOutputStream data = new DataOutputStream(out); try { FormatCommonV1.writeHeader(data, "commit"); data.writeByte(COMMIT_TREE_REF); commit.getTreeId().writeTo(data); for (ObjectId pId : commit.getParentIds()) { data.writeByte(COMMIT_PARENT_REF); pId.writeTo(data); } data.writeByte(COMMIT_AUTHOR_PREFIX); FormatCommonV1.writePerson(commit.getAuthor(), data); data.writeByte(COMMIT_COMMITTER_PREFIX); FormatCommonV1.writePerson(commit.getCommitter(), data); data.writeUTF(commit.getMessage()); } finally { data.flush(); } } }
public static void writeTag(RevTag tag, DataOutput out) throws IOException { tag.getCommitId().writeTo(out); out.writeUTF(tag.getName()); out.writeUTF(tag.getMessage()); writePerson(tag.getTagger(), out); }
public void writeNodeRef(NodeRef nodeRef, DataOutput data) throws IOException { writeNode(nodeRef.getNode(), data); nodeRef.getMetadataId().writeTo(data); data.writeUTF(nodeRef.getParentPath()); }
public static void writeNodeRef(NodeRef nodeRef, DataOutput data) throws IOException { writeNode(nodeRef.getNode(), data); nodeRef.getMetadataId().writeTo(data); data.writeUTF(nodeRef.getParentPath()); } }
public void writeCommit(RevCommit commit, DataOutput data) throws IOException { commit.getTreeId().writeTo(data); final int nParents = commit.getParentIds().size(); writeUnsignedVarInt(nParents, data); for (ObjectId pId : commit.getParentIds()) { pId.writeTo(data); } writePerson(commit.getAuthor(), data); writePerson(commit.getCommitter(), data); data.writeUTF(commit.getMessage()); }
public static void writeNode(Node node, DataOutput data, Envelope envBuff) { try { data.writeUTF(node.getName()); node.getObjectId().writeTo(data); node.getMetadataId().or(ObjectId.NULL).writeTo(data); int typeN = node.getType().value(); data.writeByte(typeN); envBuff.setToNull(); node.expand(envBuff); writeBoundingBox(envBuff, data); Map<String, Object> extraData = node.getExtraData(); DataStreamValueSerializerV1.INSTANCE.writeMap(extraData, data); } catch (IOException e) { throw new RuntimeException(e); } }
public static void serialize(DAG dag, DataOutput out) throws IOException { final ObjectId treeId = dag.originalTreeId(); final STATE state = dag.getState(); final long childCount = dag.getTotalChildCount(); treeId.writeTo(out); out.writeByte(state.ordinal()); out.writeLong(childCount); out.writeInt(dag.numChildren()); out.writeShort(dag.numBuckets()); dag.forEachChild(nodeid -> DAGSerializer.write(nodeid, out)); dag.forEachBucket(tid -> { byte[] bucketIndicesByDepth = tid.bucketIndicesByDepth; try { out.writeShort(bucketIndicesByDepth.length); out.write(bucketIndicesByDepth); } catch (IOException e) { throw new RuntimeException(e); } }); }
public static void encode(DataOutput out, RevTree tree, StringTable stringTable) throws IOException { final int size = tree.bucketsSize(); out.writeInt(size); if (0 == size) { return; } tree.forEachBucket(bucket -> { checkArgument(128 >= bucket.getIndex(), "bucket index can't exceed 127"); ObjectId objectId = bucket.getObjectId(); try { out.writeByte(bucket.getIndex()); objectId.writeTo(out); Envelope bounds = bucket.bounds().orNull(); if (bounds == null || bounds.isNull()) { out.writeDouble(Double.NaN); } else { out.writeDouble(bounds.getMinX()); out.writeDouble(bounds.getMaxX()); out.writeDouble(bounds.getMinY()); out.writeDouble(bounds.getMaxY()); } } catch (IOException e) { throw new RuntimeException(e); } }); }
public static void serialize(DAG dag, DataOutput out) throws IOException { final ObjectId treeId = dag.originalTreeId; final STATE state = dag.getState(); final long childCount = dag.getTotalChildCount(); final Collection<NodeId> children = dag.children.values(); final Set<TreeId> buckets = dag.buckets; treeId.writeTo(out); out.writeByte(state.ordinal()); Varint.writeUnsignedVarLong(childCount, out); Varint.writeUnsignedVarInt(children.size(), out); Varint.writeUnsignedVarInt(buckets.size(), out); for (NodeId nodeid : children) { NodeId.write(nodeid, out); } for (TreeId tid : buckets) { byte[] bucketIndicesByDepth = tid.bucketIndicesByDepth; Varint.writeUnsignedVarInt(bucketIndicesByDepth.length, out); out.write(bucketIndicesByDepth); } }
@Override protected void writeBucket(final Bucket bucket, DataOutput data, Envelope envBuff) throws IOException { writeUnsignedVarInt(bucket.getIndex(), data); bucket.getObjectId().writeTo(data); envBuff.setToNull(); bucket.expand(envBuff); writeBounds(envBuff, data); }
protected void writeBucket(final Bucket bucket, DataOutput data, Envelope envBuff) throws IOException { writeUnsignedVarInt(bucket.getIndex(), data); bucket.getObjectId().writeTo(data); envBuff.setToNull(); bucket.expand(envBuff); if (envBuff.isNull()) { data.writeByte(BOUNDS_NULL_MASK); } else if (envBuff.getWidth() == 0D && envBuff.getHeight() == 0D) { data.writeByte(BOUNDS_POINT_MASK); writePointBoundingBox(envBuff.getMinX(), envBuff.getMinY(), data); } else { data.writeByte(BOUNDS_BOX2D_MASK); writeBoundingBox(envBuff.getMinX(), envBuff.getMaxX(), envBuff.getMinY(), envBuff.getMaxY(), data); } }