public void writeTag ( Tag < ? > tag ) throws IOException { String name = tag . getName ( ) ; byte [ ] nameBytes = name . getBytes ( NBTConstants . CHARSET . name ( ) ) ; os . writeByte ( tag . getType ( ) . getId ( ) ) ; os . writeShort ( nameBytes . length ) ; os . write ( nameBytes ) ; if ( tag . getType ( ) == TagType . TAG_END ) { throw new IOException ( "Named TAG_End not permitted." ) ; } writeTagPayload ( tag ) ; }
Writes a tag .