protected void flushCache() throws IOException {
  if (cachePosition > 0) {
    final byte chunkHeader[]=EncodingUtil.getAsciiBytes(Integer.toHexString(cachePosition) + "\r\n");
    stream.write(chunkHeader,0,chunkHeader.length);
    stream.write(cache,0,cachePosition);
    stream.write(ENDCHUNK,0,ENDCHUNK.length);
    cachePosition=0;
  }
}

protected void flushCache ( ) throws IOException { if ( cachePosition > 0 ) { final byte chunkHeader [ ] = EncodingUtil . getAsciiBytes ( Integer . toHexString ( cachePosition ) + "\r\n" ) ; stream . write ( chunkHeader , 0 , chunkHeader . length ) ; stream . write ( cache , 0 , cachePosition ) ; stream . write ( ENDCHUNK , 0 , ENDCHUNK . length ) ; cachePosition = 0 ; } }
writes the cache out onto the underlying stream
