public byte[] format() throws IOException {
TreeFormatter fmt = new TreeFormatter();
for (TreeEntry e : members()) {
ObjectId id = e.getId();
if (id == null)
throw new ObjectWritingException(MessageFormat.format(JGitText
.get().objectAtPathDoesNotHaveId, e.getFullName()));
fmt.append(e.getNameUTF8(), e.getMode(), id);
}
return fmt.toByteArray();