Is bytearrayoutputstream wrapped in GZIPOutputStream blocking operation

133 views Asked by At
val baos = new ByteArrayOutputStream(input.size)
val gzipOut = new GZIPOutputStream(baos)
try {
  gzipOut.write(input.getBytes("UTF-8"), 0, input.length)
  gzipOut.finish()
} finally {
  gzipOut.close()
}

baos.toByteArray

I am trying to compress some data using java gzipoutputstream - it wraps bytearrayoutputstream. is gzipOut.write blocking operation? The gzip out ultimately writes data in memory (and not over disk/network). SO can this or any operation written in above code block the thread of execution?

Note: i am using the above code in scala which is essentially non-blocking application.

0

There are 0 answers