how to write a csv file to a gzip in java. While writingmy csv type is getting changed to file type. I want it to be .csv??? this is the code i used...
public class zipWrite extends commonParts{
public static void zip() throws Exception{
zipWriter= new FileOutputStream("C:\\Users\\myzip.gz");
outputStream = new GZIPOutputStream(zipWriter);
zipIn = new FileInputStream("C:\\Users\\mycsv.csv");
byte []buffer = new byte[1024];
int length;
while ((length = zipIn.read(buffer)) > 0) {
outputStream.write(buffer, 0, length);
}
zipIn.close();
outputStream.close();
}
}