public ObjectId idFor(int objectType, long length, InputStream in)throws IOException {SHA1 md = SHA1.newInstance();md.update(Constants.encodedTypeString(objectType));md.update((byte) ' ');md.update(Constants.encodeASCII(length));md.update((byte) 0);byte[] buf = buffer();while (length > 0) {int n = in.read(buf, 0, (int) Math.min(length, buf.length));if (n < 0)throw new EOFException(JGitText.get().unexpectedEndOfInput);md.update(buf, 0, n);length -= n;}return md.toObjectId();}

public virtual ObjectId IdFor(int objectType, long length, InputStream @in){MessageDigest md = Digest();md.Update(Constants.EncodedTypeString(objectType));md.Update(unchecked((byte)' '));md.Update(Constants.EncodeASCII(length));md.Update(unchecked((byte)0));byte[] buf = Buffer();while (length > 0){int n = @in.Read(buf, 0, (int)Math.Min(length, buf.Length));if (n < 0){throw new EOFException("Unexpected end of input");}md.Update(buf, 0, n);length -= n;}return ObjectId.FromRaw(md.Digest());}
