code: private void writeBlock(final WritableByteChannel out, ByteBuffer data,
              boolean compressed, int crc32c)
              throws IOException
      {
  
          headerBuffer.clear();
          headerBuffer.put((byte) (compressed ? COMPRESSED_DATA_FLAG
                  : UNCOMPRESSED_DATA_FLAG));
  
          // the length written out to the header is both the checksum and the
          // frame
          final int headerLength = data.remaining() + 4;
  
          // write length
          headerBuffer.put((byte) headerLength);
          headerBuffer.put((byte) (headerLength >>> 8));
          headerBuffer.put((byte) (headerLength >>> 16));
  
          // write crc32c of user input data
          headerBuffer.putInt(crc32c);
  
          headerBuffer.flip();
  
          // write the header
          out.write(headerBuffer);
          // write the raw data
          out.write(data);
      }
docs: Write a frame (block) to <i>out</i>.
  
  @param out The {@link OutputStream} to write to.
  @param data The data to write.
  @param compressed Indicates if <i>data</i> is the compressed or raw content.
  This is based on whether the compression ratio desired is
  reached.
  @param crc32c The calculated checksum.
  @throws IOException