Browse Source

Add copyTo(ByteBuffer) to AnyObjectId

Change-Id: I3572f6113db883002f9c3a5ecc1bcc8370105c98
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
stable-0.9
Shawn O. Pearce 14 years ago
parent
commit
d1ebc4aa00
  1. 10
      org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java

10
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); 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() { private byte[] toHexByteArray() {
final byte[] dst = new byte[Constants.OBJECT_ID_STRING_LENGTH]; final byte[] dst = new byte[Constants.OBJECT_ID_STRING_LENGTH];
formatHexByte(dst, 0, w1); formatHexByte(dst, 0, w1);

Loading…
Cancel
Save