private static int parseId3Header(ParsableByteArray id3Buffer) throws ParserException {
  int id1=id3Buffer.readUnsignedByte();
  int id2=id3Buffer.readUnsignedByte();
  int id3=id3Buffer.readUnsignedByte();
  if (id1 != 'I' || id2 != 'D' || id3 != '3') {
    throw new ParserException(String.format("Unexpected ID3 file identifier, expected \"ID3\", actual \"%c%c%c\".",id1,id2,id3));
  }
  id3Buffer.skip(2);
  int flags=id3Buffer.readUnsignedByte();
  int id3Size=id3Buffer.readSynchSafeInt();
  if ((flags & 0x2) != 0) {
    int extendedHeaderSize=id3Buffer.readSynchSafeInt();
    if (extendedHeaderSize > 4) {
      id3Buffer.skip(extendedHeaderSize - 4);
    }
    id3Size-=extendedHeaderSize;
  }
  if ((flags & 0x8) != 0) {
    id3Size-=10;
  }
  return id3Size;
}

private static int parseId3Header ( ParsableByteArray id3Buffer ) throws ParserException { int id1 = id3Buffer . readUnsignedByte ( ) ; int id2 = id3Buffer . readUnsignedByte ( ) ; int id3 = id3Buffer . readUnsignedByte ( ) ; if ( id1 != 'I' || id2 != 'D' || id3 != '3' ) { throw new ParserException ( String . format ( "Unexpected ID3 file identifier, expected \"ID3\", actual \"%c%c%c\"." , id1 , id2 , id3 ) ) ; } id3Buffer . skip ( 2 ) ; int flags = id3Buffer . readUnsignedByte ( ) ; int id3Size = id3Buffer . readSynchSafeInt ( ) ; if ( ( flags & 0x2 ) != 0 ) { int extendedHeaderSize = id3Buffer . readSynchSafeInt ( ) ; if ( extendedHeaderSize > 4 ) { id3Buffer . skip ( extendedHeaderSize - 4 ) ; } id3Size -= extendedHeaderSize ; } if ( ( flags & 0x8 ) != 0 ) { id3Size -= 10 ; } return id3Size ; }
parses an id3 header .
