File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accessing mp3 properties (128 bytes at the end) dirty hack...How to make this more efficient?

 
john price
Ranch Hand
Posts: 495
Chrome Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I looked at the I/O API and came up with a dirty hack. I know that the last 128 bytes for mp3 files are the properties for these files. I tested my code (below) on some real life mp3 files (the 3 that came with my computer). It works fine, but I know this is just a cheap hack. Is there a better way to do this? I am doing it twice. There has to be a way to do it once...

Thanks,
cc11rocks


EDIT: Made the code just send off an error if it doesn't have ID3 in the beginning (which I believe is the format of the mp3 that I am doing).
 
Madhan Sundararajan Devaki
Ranch Hand
Posts: 312
Java MS IE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may re-write as follows.

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic