code: public void writeTag(Tag tag) throws IOException {
          byte[] hb = tag.encode();
          bytesWritten += hb.length;
          dataFile.write(hb);
      }
docs: will write tag bytesWritten counter will be increased by the number of bytes actually written
  
  @param tag
  - tag to be written
  @throws IOException
  - in case of any IO errors