I have a BufferedWriter as shown below:
BufferedWriter
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter( new GZIPOutputStream( hdfs.cr
You can use the CountingOutputStream from Apache commons IO library.
Place it between the GZIPOutputStream and the file Outputstream (hdfs.create(..)).
After writing the content to the file you can read the number of written bytes from the CountingOutputStream instance.