Skip to content

Instantly share code, notes, and snippets.

@thuytrinh
Last active September 21, 2018 13:56
Show Gist options
  • Select an option

  • Save thuytrinh/cb79bc9e156d0cdf1def13aa1aab44ef to your computer and use it in GitHub Desktop.

Select an option

Save thuytrinh/cb79bc9e156d0cdf1def13aa1aab44ef to your computer and use it in GitHub Desktop.
A sample usage of GzipSink & GzipSource from Okio
class OkioTest {
@Test
fun `should compress file properly`() {
val originalFile = File("(ʘ‿ʘ)")
Okio.sink(originalFile).use { fileSink ->
Okio.buffer(GzipSink(fileSink)).use { bufferedSink ->
bufferedSink.writeUtf8("。◕‿◕。\n")
bufferedSink.writeUtf8("ಠoಠ\n")
bufferedSink.writeUtf8("♥‿♥\n")
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment