Please Help its urgent........requirement is to read a .gz file

and to randomly acces it...If i read the file line by line using GZIPInputStream it takes lot of time...My requirement is to pick some line (say 35000) randomly......Please suggest any alternative.....
[250 byte] By [puneet.kumara] at [2007-11-27 4:16:03]
# 1
I have told you once already.Please don't cross post. It is considered very rude. Anyone wishing to reply here, please reply to the following thread, instead: http://forum.java.sun.com/thread.jspa?threadID=5172156&tstart=0
masijade.a at 2007-7-12 9:22:31 > top of Java-index,Java Essentials,Java Programming...
# 2

use this code to unzip a .gzip file:

try {

// Open the compressed file

String inFilename = "infile.gzip";

GZIPInputStream in = new GZIPInputStream(new FileInputStream(inFilename));

// Open the output file

String outFilename = "outfile";

OutputStream out = new FileOutputStream(outFilename);

// Transfer bytes from the compressed file to the output file

byte[] buf = new byte[1024];

int len;

while ((len = in.read(buf)) > 0) {

out.write(buf, 0, len);

}

// Close the file and stream

in.close();

out.close();

} catch (IOException e) {

}

java_2006a at 2007-7-12 9:22:31 > top of Java-index,Java Essentials,Java Programming...
# 3

that's is ok...

I 've already used it....

I am able to read the contents of the file ....

But my requirement is to minimize the reading time of the file.....

I want to pick some line on a random basis...

So if u can tell me some alternative which meets my requirement ,....

It would be grateful...

puneet.kumara at 2007-7-12 9:22:31 > top of Java-index,Java Essentials,Java Programming...
# 4
can't see the urgency...
jwentinga at 2007-7-12 9:22:31 > top of Java-index,Java Essentials,Java Programming...
# 5
can't see the urgency?I didn't understand what u mean by that.
puneet.kumara at 2007-7-12 9:22:31 > top of Java-index,Java Essentials,Java Programming...
# 6
> use this code to unzip a .gzip file:> > ...Source: http://www.exampledepot.com/egs/java.util.zip/UncompressFile.html
prometheuzza at 2007-7-12 9:22:31 > top of Java-index,Java Essentials,Java Programming...
# 7
> can't see the urgency?> > I didn't understand what u mean by that.It's called sarcasm.
prometheuzza at 2007-7-12 9:22:31 > top of Java-index,Java Essentials,Java Programming...
# 8

> use this code to unzip a .gzip file:

>

> ...

Source: http://www.exampledepot.com/egs/java.util.zip/UncompressFile.html

Thanks for reply ....As i earlier Stated that I already follwed these steps...

I am, able to read the GZIP file ....

But i want to access it Randomly....

puneet.kumara at 2007-7-12 9:22:31 > top of Java-index,Java Essentials,Java Programming...
# 9

> ...

> Thanks for reply ....As i earlier Stated that I

> already follwed these steps...

> I am, able to read the GZIP file ....

> But i want to access it Randomly....

I wasn't replying to you, but to java_2006 who is frequently posting code he "borrowed" from somewhere without mentioning it's not his work (aka plagiarism).

prometheuzza at 2007-7-12 9:22:31 > top of Java-index,Java Essentials,Java Programming...