Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Random accessing a gzip file

by grondilu (Friar)
on Oct 17, 2012 at 01:05 UTC ( #999446=note: print w/replies, xml ) Need Help??


in reply to Random accessing a gzip file

From the manual page of IO::Uncompress::Gunzip, I read:

seek
$z->seek($position, $whence); seek($z, $position, $whence);
Provides a sub-set of the "seek" functionality, with the restriction that it is only legal to seek forward in the input file/buffer. It is a fatal error to attempt to seek backward.
tell
Usage is
$z->tell() tell $z
Returns the uncompressed file offset.

So yes, you can, but of course it can not be as easy as with an uncompressed file.

Replies are listed 'Best First'.
Re^2: Random accessing a gzip file
by pmqs (Pilgrim) on Oct 17, 2012 at 13:13 UTC
    Note that the implementation of seek in IO::Uncompress::Gunzip does not provide true random access to a compressed file. It works by uncompressing data from the current offset in the file/buffer until it reaches the ucompressed offset specified in the parameters to seek. For very small files this may be acceptable behaviour. For large files it may cause an unacceptable delay.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://999446]
help
Chatterbox?
[james28909]: what i am trying to do is track state of a chat based application. i need to be able to store the channels and such for a user, and when they join a new server/channel i need to be able to update that feild.
[james28909]: do you think OO would best suite that?
[karlgoethebier]: james28909: The last two are not mainstream. You have been warned ;-)
[karlgoethebier]: james28909: I don't know. Try it.
[james28909]: foreach server this bot is on, the gateway sends me a json response, which i parse out all the info with JSON, and this response has user information, i need to be able to add a user, and then update the user info when they join/leave rooms ect

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (11)
As of 2017-05-25 16:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?