public String toString() {byte[] raw = toByteArray();CanonicalTreeParser p = new CanonicalTreeParser();p.reset(raw);StringBuilder r = new StringBuilder();r.append("Tree={");if (!p.eof()) {r.append('\n');try {new ObjectChecker().checkTree(raw);} catch (CorruptObjectException error) {r.append("*** ERROR: ").append(error.getMessage()).append("\n");r.append('\n');}}while (!p.eof()) {final FileMode mode = p.getEntryFileMode();r.append(mode);r.append(' ');r.append(Constants.typeString(mode.getObjectType()));r.append(' ');r.append(p.getEntryObjectId().name());r.append(' ');r.append(p.getEntryPathString());r.append('\n');p.next();}r.append("}");return r.toString();}

public override string ToString(){byte[] raw = ToByteArray();CanonicalTreeParser p = new CanonicalTreeParser();p.Reset(raw);StringBuilder r = new StringBuilder();r.Append("Tree={");if (!p.Eof){r.Append('\n');try{new ObjectChecker().CheckTree(raw);}catch (CorruptObjectException error){r.Append("*** ERROR: ").Append(error.Message).Append("\n");r.Append('\n');}}while (!p.Eof){FileMode mode = p.EntryFileMode;r.Append(mode);r.Append(' ');r.Append(Constants.TypeString(mode.GetObjectType()));r.Append(' ');r.Append(p.EntryObjectId.Name);r.Append(' ');r.Append(p.EntryPathString);r.Append('\n');p.Next();}r.Append("}");return r.ToString();}
