commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "C. Grobmeier" <>
Subject Re: [compress] Discussing compress
Date Tue, 14 Feb 2006 17:03:01 GMT
>>> How do you delete a file and shrink the archive?
>> I thought about reading the zip spec and cutting out the bytes i don't
>> need.
> I am not aware of a file operation which allows you to cut out a number
> of bytes from a file. I think there exists a "cut from end", but AFAIK
> this is not available in java, nor is it available with filesystems like
> webdav, ftp or cifs.
> I hoped compress will be able to write to files on those filesystems too
> (with the help of VFS for sure :-) )

My mistake: with cutting off i meant: reading (in a loop) the bytes and 
writing only the necessary bytes in a temp-file. There is a skip 
function. CUtting out is not possible, you are right.

>>>> I found out that i possibly can use RandomAccessFile and read byte for
>>>> byte and write in back to the same file at the same time.
>>> Sure, but you have to write a compressed stream.
>> Does that matter? Byte is a Byte is a Byte, i would daresay. At the
>> moment i don't want to reimplement the compressing algorithms but want
>> to extend the Zip-API.
> Your RandomAccessFile directly manipulates the archive, no?
> So when you change bytes they have to follow the spec.
> so if you archive looks like: asldkjg which represents the text
> "compress is super duper" your RandomAccessFile only sees the bytes
> "asldkjg"
> now if you change "compress is super duper" to "compress is duper super"
> the bytes might look like "asuriz"
> This is very simplified, you have to manage a directory structure too.

I will think about it. RandomAccessFile is not my first choice, after we 
figured out that we need a temp-file. My first choice is 
FileIn/OutStream, see above.

> If you manage to do that, than I'll salut you ;-)

I'll remind that and try it out ;-)


> ---
> Mario
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message