Consolidate the string type decoding into Constants
commit2273c631c06bafd3565b0b695450a61f0e28a6e5
authorShawn O. Pearce <spearce@spearce.org>
Sun, 18 May 2008 19:42:34 +0000 (18 15:42 -0400)
committerShawn O. Pearce <spearce@spearce.org>
Sun, 18 May 2008 19:42:34 +0000 (18 15:42 -0400)
tree963de74fca0e653d69205846d7d676eafe7ca68a
parent771d22ca4dd38932282b7f4c294341c56d0f7cf5
Consolidate the string type decoding into Constants

We have the same block of code in both UnpackedObjectLoader and in
RevTag to parse an object type name such as "blob" into the value
we use internally to represent that type.  Rather than duplicating
this code we can abstract it out into Constants.decodeTypeString,
the opposite of the existing Constants.encodedTypeString method.

We also can use RawParseUtils.parseBase10 to read the length of an
unpacked object from its header.  This parser has generally shown
to be faster than the loop we were using before.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
org.spearce.jgit/src/org/spearce/jgit/lib/Constants.java
org.spearce.jgit/src/org/spearce/jgit/lib/UnpackedObjectLoader.java
org.spearce.jgit/src/org/spearce/jgit/revwalk/RevTag.java