Skip to content

Instantly share code, notes, and snippets.

@mydpy
mydpy / gz.scala
Created May 21, 2019 — forked from pauca/gz.scala
scala read / write from compressed gz
View gz.scala
import java.io._
import java.util.zip._
import scala.io.Source
var in = new GZIPInputStream(new FileInputStream("test.gz"))
// write setup in different objects to close later properly (important for big files )
var fos = new FileOutputStream("test2.gz")
var gzos = new GZIPOutputStream( fos )
var w = new PrintWriter(gzos)