code: public static void bufferedWriteWithFlush(final OutputStream output, final byte[] content) throws IOException {
          final int size = 4096;
          int offset = 0;
          while (content.length - offset > size) {
              output.write(content, offset, size);
              offset += size;
          }
          output.write(content, offset, content.length - offset);
          output.flush();
      }
docs: Writing the specified contents to the specified OutputStream using an internal buffer. Flushing the stream when
  completed. Caller is responsible for opening and closing the specified stream.
  
  @param output
  The OutputStream
  @param content
  The content to write to the specified stream
  @throws IOException
  If a problem occured during any I/O operations