/** * Convert an AbbreviatedObjectId from hex characters (US-ASCII). * * @param buf * the US-ASCII buffer to read from. * @param offset * position to read the first character from. * @param end * one past the last position to read (<code>end-offset</code> is * the length of the string). * @return the converted object id. */ public static final AbbreviatedObjectId fromString(final byte[] buf, final int offset, final int end) { if (end - offset > Constants.OBJECT_ID_STRING_LENGTH) throw new IllegalArgumentException(MessageFormat.format( JGitText.get().invalidIdLength, Integer.valueOf(end - offset), Integer.valueOf(Constants.OBJECT_ID_STRING_LENGTH))); return fromHexString(buf, offset, end); }
/** * Convert an AbbreviatedObjectId from hex characters. * * @param str * the string to read from. Must be <= 40 characters. * @return the converted object id. */ public static final AbbreviatedObjectId fromString(String str) { if (str.length() > Constants.OBJECT_ID_STRING_LENGTH) throw new IllegalArgumentException(MessageFormat.format(JGitText.get().invalidId, str)); final byte[] b = Constants.encodeASCII(str); return fromHexString(b, 0, b.length); }
/** * Convert an AbbreviatedObjectId from hex characters. * * @param str * the string to read from. Must be <= 40 characters. * @return the converted object id. */ public static final AbbreviatedObjectId fromString(String str) { if (str.length() > Constants.OBJECT_ID_STRING_LENGTH) throw new IllegalArgumentException(MessageFormat.format(JGitText.get().invalidId, str)); final byte[] b = Constants.encodeASCII(str); return fromHexString(b, 0, b.length); }
/** * Convert an AbbreviatedObjectId from hex characters (US-ASCII). * * @param buf * the US-ASCII buffer to read from. * @param offset * position to read the first character from. * @param end * one past the last position to read (<code>end-offset</code> is * the length of the string). * @return the converted object id. */ public static final AbbreviatedObjectId fromString(final byte[] buf, final int offset, final int end) { if (end - offset > Constants.OBJECT_ID_STRING_LENGTH) throw new IllegalArgumentException(MessageFormat.format( JGitText.get().invalidIdLength, Integer.valueOf(end - offset), Integer.valueOf(Constants.OBJECT_ID_STRING_LENGTH))); return fromHexString(buf, offset, end); }
/** * Convert an AbbreviatedObjectId from hex characters. * * @param str * the string to read from. Must be <= 40 characters. * @return the converted object id. */ public static final AbbreviatedObjectId fromString(final String str) { if (str.length() > Constants.OBJECT_ID_STRING_LENGTH) throw new IllegalArgumentException(MessageFormat.format(JGitText.get().invalidId, str)); final byte[] b = Constants.encodeASCII(str); return fromHexString(b, 0, b.length); }
/** * Convert an AbbreviatedObjectId from hex characters (US-ASCII). * * @param buf * the US-ASCII buffer to read from. * @param offset * position to read the first character from. * @param end * one past the last position to read (<code>end-offset</code> is * the length of the string). * @return the converted object id. */ public static final AbbreviatedObjectId fromString(final byte[] buf, final int offset, final int end) { if (end - offset > Constants.OBJECT_ID_STRING_LENGTH) throw new IllegalArgumentException(MessageFormat.format( JGitText.get().invalidIdLength, Integer.valueOf(end - offset), Integer.valueOf(Constants.OBJECT_ID_STRING_LENGTH))); return fromHexString(buf, offset, end); }