/** * Copy this ObjectId to a StringBuilder in hex format. * * @param tmp temporary char array to buffer construct into before writing. Must be at least large * enough to hold 2 digits for each byte of object id (40 characters or larger). * @param w the string to append onto. */ public void copyTo(final char[] tmp, final StringBuilder w) { toHexCharArray(tmp); w.append(tmp, 0, Constants.OBJECT_ID_STRING_LENGTH); }
private char[] toHexCharArray() { final char[] dst = new char[Constants.OBJECT_ID_STRING_LENGTH]; toHexCharArray(dst); return dst; }
/** * Copy this ObjectId to an output writer in hex format. * * @param tmp temporary char array to buffer construct into before writing. Must be at least large * enough to hold 2 digits for each byte of object id (40 characters or larger). * @param w the stream to copy to. * @throws IOException the stream writing failed. */ public void copyTo(final char[] tmp, final Writer w) throws IOException { toHexCharArray(tmp); w.write(tmp, 0, Constants.OBJECT_ID_STRING_LENGTH); }