public byte[] build() {ByteArrayOutputStream os = new ByteArrayOutputStream();try (OutputStreamWriter w = new OutputStreamWriter(os,UTF_8)) {w.write("object "); getObjectId().copyTo(w);w.write('\n');w.write("type "); w.write(Constants.typeString(getObjectType()));w.write("\n"); w.write("tag "); w.write(getTag());w.write("\n"); if (getTagger() != null) {w.write("tagger "); w.write(getTagger().toExternalString());w.write('\n');}w.write('\n');if (getMessage() != null)w.write(getMessage());} catch (IOException err) {throw new RuntimeException(err);}return os.toByteArray();}
public virtual byte[] Build(){ByteArrayOutputStream os = new ByteArrayOutputStream();OutputStreamWriter w = new OutputStreamWriter(os, Constants.CHARSET);try{w.Write("object ");GetObjectId().CopyTo(w);w.Write('\n');w.Write("type ");w.Write(Constants.TypeString(GetObjectType()));w.Write("\n");w.Write("tag ");w.Write(GetTag());w.Write("\n");if (GetTagger() != null){w.Write("tagger ");w.Write(GetTagger().ToExternalString());w.Write('\n');}w.Write('\n');if (GetMessage() != null){w.Write(GetMessage());}w.Close();}catch (IOException err){throw new RuntimeException(err);}return os.ToByteArray();}