File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes I/O and Streams and the fly likes Accessing mp3 properties (128 bytes at the end) dirty hack...How to make this more efficient? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Accessing mp3 properties (128 bytes at the end) dirty hack...How to make this more efficient?" Watch "Accessing mp3 properties (128 bytes at the end) dirty hack...How to make this more efficient?" New topic
Author

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

john price
Ranch Hand

Joined: Feb 24, 2011
Posts: 495

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).


“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” (Mosher's Law of Software Engineering)
“If debugging is the process of removing bugs, then programming must be the process of putting them in.” (Edsger Dijkstra)
Madhan Sundararajan Devaki
Ranch Hand

Joined: Mar 18, 2011
Posts: 312

You may re-write as follows.



S.D. MADHAN
Not many get the right opportunity !
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Accessing mp3 properties (128 bytes at the end) dirty hack...How to make this more efficient?
 
Similar Threads
How a character save in 2 bytes in Java?
ASCII to EBCIDIC conversion error
file, UTF8
How can I get Unicode String of a String?
FileInputStream - Replace Characters - FileInputStream