code: private OutputStream getOutputStream(final String keyFile) throws IOException {
          try {
              return AccessController.doPrivileged(new PrivilegedExceptionAction<OutputStream>() {
                  @Override
                  public OutputStream run() throws IOException {
                      return new FileOutputStream(new File(keyFile));
                  }
              });
          } catch (PrivilegedActionException e) {
              // Wrap the wrapped IOException from doPriv in an IOException and re-throw
              throw new IOException(e.getCause());
          }
      }
docs: Obtain the OutputStream for the given file.
  
  @param keyFile
  @return
  @throws IOException