private void parseFrames ( RandomAccessInputStream raf ) throws FileNotFoundException , IOException , ID3v2FormatException { int offset = head . getHeaderSize ( ) ; int framesLength = head . getTagSize ( ) ; if ( head . getExtendedHeader ( ) ) { framesLength -= ext_head . getSize ( ) ; offset += ext_head . getSize ( ) ; } raf . seek ( offset ) ; int bytesRead = 0 ; boolean done = false ; while ( ( bytesRead < framesLength ) && ! done ) { byte [ ] buf = new byte [ 4 ] ; bytesRead += raf . read ( buf ) ; if ( buf [ 0 ] != 0 ) { String id = new String ( buf ) ; bytesRead += raf . read ( buf ) ; int curLength = Helpers . convertDWordToInt ( buf , 0 ) ; byte [ ] flags = new byte [ 2 ] ; bytesRead += raf . read ( flags ) ; byte [ ] data = new byte [ curLength ] ; bytesRead += raf . read ( data ) ; ID3v2Frame frame = new ID3v2Frame ( id , flags , data ) ; frames . put ( id , frame ) ; } else { done = true ; padding = framesLength - bytesRead - buf . length ; } } }
Read the frames from the file and create ID3v2Frame objects from the data found .