public void writeTag ( RandomAccessFile raf ) throws FileNotFoundException , IOException { if ( headerExists ) raf . seek ( raf . length ( ) - TAG_SIZE ) ; else raf . seek ( raf . length ( ) ) ; raf . write ( Helpers . getBytesFromString ( TAG_START , TAG_START . length ( ) , ENC_TYPE ) ) ; raf . write ( Helpers . getBytesFromString ( title , TITLE_SIZE , ENC_TYPE ) ) ; raf . write ( Helpers . getBytesFromString ( artist , ARTIST_SIZE , ENC_TYPE ) ) ; raf . write ( Helpers . getBytesFromString ( album , ALBUM_SIZE , ENC_TYPE ) ) ; raf . write ( Helpers . getBytesFromString ( year , YEAR_SIZE , ENC_TYPE ) ) ; raf . write ( Helpers . getBytesFromString ( comment , COMMENT_SIZE , ENC_TYPE ) ) ; raf . write ( ( byte ) track ) ; raf . write ( ( byte ) genre ) ; headerExists = true ; }
Writes the information in this tag to the file specified in the constructor . If a tag does not exist one will be created . If a tag already exists it will be overwritten .