code: public byte[] createCompressedFrame(byte[] dataFrames) throws IOException {
          ByteArrayOutputStream output = new ByteArrayOutputStream();
          output.write(dataFrames);
          //Compress the bytes using zlib level 6
          byte[] cBytes = new byte[output.size()];
          deflater.setInput(output.toByteArray());
          deflater.finish();
          int compressedLength = deflater.deflate(cBytes);
          //Reset the deflater
          deflater.reset();
          //Clear the output stream and fill it with compressed byte data
          output.reset();
  
          output.write(PROTOCOL_VERSION.getBytes(UTF_8)); //Protocol version
          output.write(COMPRESS_FRAME_TYPE.getBytes(UTF_8)); //Frame type 'C'
          output.write(ByteBuffer.allocate(4).putInt(compressedLength).array());//32-bit payload length
          output.write(Arrays.copyOf(cBytes, compressedLength));// Compressed byte data
          return output.toByteArray();
      }
docs: Creates a compressed frame for lumberjack protocol.
  
  @param dataFrames Data frames as a byte array
  @return Compressed frame as a byte array
  @throws IOException