gzipinputstream

GZIPInputStream to String

為{幸葍}努か 提交于 2019-11-27 10:47:10
问题 First of all, I'm sorry if my terminology is a bit amateur, try to bear with me ;) I am attempting to convert the gzipped body of a HTTP response to plaintext. I've taken the byte array of this response and converted it to a ByteArrayInputStream. I've then converted this to a GZIPInputStream. I now want to read the GZIPInputStream and store the final decompressed HTTP response body as a plaintext String. This code will store the final decompressed contents in an OutputStream, but I want to

GZIPInputStream reading line by line

百般思念 提交于 2019-11-27 06:08:27
I have a file in .gz format. The java class for reading this file is GZIPInputStream. However, this class doesn't extend the BufferedReader class of java. As a result, I am not able to read the file line by line. I need something like this reader = new MyGZInputStream( some constructor of GZInputStream) reader.readLine()... I though of creating my class which extends the Reader or BufferedReader class of java and use GZIPInputStream as one of its variable. import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import

How to decompress a gzipped data in a byte array?

断了今生、忘了曾经 提交于 2019-11-26 14:46:49
问题 I have a class which has a method that is receiving an object as a parameter. This method is invoked via RMI. public RMIClass extends Serializable { public RMIMethod(MyFile file){ // do stuff } } MyFile has a property called "body", which is a byte array. public final class MyFile implements Serializable { private byte[] body = new byte[0]; //.... public byte[] getBody() { return body; } //.... } This property holds the gzipped data of a file that was parsed by another application. I need to

GZIPInputStream reading line by line

感情迁移 提交于 2019-11-26 11:52:13
问题 I have a file in .gz format. The java class for reading this file is GZIPInputStream. However, this class doesn\'t extend the BufferedReader class of java. As a result, I am not able to read the file line by line. I need something like this reader = new MyGZInputStream( some constructor of GZInputStream) reader.readLine()... I though of creating my class which extends the Reader or BufferedReader class of java and use GZIPInputStream as one of its variable. import java.io.BufferedReader;