The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
December 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Cutting off ID3v2-Tags of mp3-files

Posted by Tony NG on December 18, 2001 at 5:57 AM

Yeah, I guess you are right. But i wonder how some applications cut or change the ID3v2-Tags of an mp3-files (those tags are positioned at the beginning)? See Winamp for example. I guess they just copy the rest of the file?!

Thx for your answer.

Ciao,

Tony

>
> > Hello, does anyone know how to remove say the first 10 bytes of a file _without_ copying the whole file?
> > Thx for your help.
> > Tony
>

> I think not. I can't think of a file system that doesn't store files in a series of blocks, which are usually hundreds (floppies) or many thousands (hard disks) of bytes long. Imagine the first block of a file: how would you take a few bytes off the beginning of it? The file must start at the beginning of the block. That meas all the bytes must be "shifted left." You can't have any "empty" space in a block (except the last one), so that of course means the next block must also be "shifted left" into it and so on down the line.

> You could come up with your own file format that specifies (at the end of the file) where the start point is in the file. Then you could tweak this one number, so that when the file is read, it knows what to ignore. Alternatively, you could do a variation on this trick, where there is an index file in the same directory which says where to offset into each file.

> Or you could go ahead and just do the copy method; unless you have many huge files and it is not a one-time operation, the performance hit shouldn't be a show stopper.






Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us