From d1ebc4aa0099b15c06eeecad392c4e00eb9b9414 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Fri, 30 Jul 2010 08:51:11 -0700 Subject: [PATCH] Add copyTo(ByteBuffer) to AnyObjectId Change-Id: I3572f6113db883002f9c3a5ecc1bcc8370105c98 Signed-off-by: Shawn O. Pearce --- .../src/org/eclipse/jgit/lib/AnyObjectId.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java index e2060a0afa..c6cb433aa4 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java @@ -339,6 +339,16 @@ public abstract class AnyObjectId implements Comparable { formatHexByte(b, o + 32, w5); } + /** + * Copy this ObjectId to a ByteBuffer in hex format. + * + * @param b + * the buffer to copy to. + */ + public void copyTo(ByteBuffer b) { + b.put(toHexByteArray()); + } + private byte[] toHexByteArray() { final byte[] dst = new byte[Constants.OBJECT_ID_STRING_LENGTH]; formatHexByte(dst, 0, w1); -- 2.39.5