private void writeTag(String name,Tag tag) throws IOException {
  TagType type=tag.getType();
  byte[] nameBytes=name.getBytes(StandardCharsets.UTF_8);
  if (type == TagType.END) {
    throw new IOException("Named TAG_End not permitted.");
  }
  os.writeByte(type.getId());
  os.writeShort(nameBytes.length);
  os.write(nameBytes);
  writeTagPayload(tag);
}

private void writeTag ( String name , Tag tag ) throws IOException { TagType type = tag . getType ( ) ; byte [ ] nameBytes = name . getBytes ( StandardCharsets . UTF_8 ) ; if ( type == TagType . END ) { throw new IOException ( "Named TAG_End not permitted." ) ; } os . writeByte ( type . getId ( ) ) ; os . writeShort ( nameBytes . length ) ; os . write ( nameBytes ) ; writeTagPayload ( tag ) ; }
write a tag with a name .
