]> source.dussan.org Git - jgit.git/commitdiff
Add copyTo(ByteBuffer) to AnyObjectId 15/1215/3
authorShawn O. Pearce <spearce@spearce.org>
Fri, 30 Jul 2010 15:51:11 +0000 (08:51 -0700)
committerShawn O. Pearce <spearce@spearce.org>
Sat, 21 Aug 2010 00:41:27 +0000 (17:41 -0700)
Change-Id: I3572f6113db883002f9c3a5ecc1bcc8370105c98
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java

index e2060a0afa01bb0843ac1f4053fdb1388798cdec..c6cb433aa48adc60aaa99c9d8ec7a6adb2f15e71 100644 (file)
@@ -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);