code: private boolean checkOutputFileEncoding(String docencoding,
              DocErrorReporter reporter) {
          OutputStream ost= new ByteArrayOutputStream();
          OutputStreamWriter osw = null;
          try {
              osw = new OutputStreamWriter(ost, docencoding);
          } catch (UnsupportedEncodingException exc) {
              reporter.printError(getText("doclet.Encoding_not_supported",
                  docencoding));
              return false;
          } finally {
              try {
                  if (osw != null) {
                      osw.close();
                  }
              } catch (IOException exc) {
              }
          }
          return true;
      }
docs: Check the validity of the given Source or Output File encoding on this
  platform.
  
  @param docencoding output file encoding.
  @param reporter    used to report errors.