code: private static void write(DocFile outFile, OutputStream out, byte[] buf, int len) throws DocFileIOException {
          try {
              out.write(buf, 0, len);
          } catch (IOException e) {
              throw new DocFileIOException(outFile, DocFileIOException.Mode.WRITE, e);
          }
      }
docs: Writes to an output stream for a given file from a given buffer.
  If an IOException occurs, it is wrapped in a DocFileIOException.
  
  @param outFile the file for the stream
  @param out the stream
  @param buf the buffer
  @throws DocFileIOException if an exception occurred while writing the stream