code: public void write(boolean skipNonOverrides,
                        boolean withXMLDeclaration,
                        PrintWriter writer) {
  
          final String indent = "                           ";
  
          // header
          if (withXMLDeclaration) {
              writer.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
          }
          writer.println("<" + _CONFIG + " xmlns=\"" + BE_SECURITY.uri + "\"");
          writer.println(indent + " xmlns:xsi=\"" + XSI.uri + "\"");
          writer.println(indent + " xsi:schemaLocation=\"" + BE_SECURITY.uri
                  + " " + BE_SECURITY1_0.xsdLocation + "\"");
  
          // default values
          writer.print(indent);
          write(m_defaultConfig, false, skipNonOverrides, writer);
          writer.println(">");
  
          // fedoraInternalCall-1 and -2
          writeInternalConfig(1,
                              m_internalSSL,
                              m_internalBasicAuth,
                              m_internalUsername,
                              m_internalPassword,
                              m_internalIPList,
                              writer);
          writeInternalConfig(2,
                              Boolean.FALSE,
                              Boolean.FALSE,
                              null,
                              null,
                              m_internalIPList,
                              writer);
  
          // sDep roles
          Iterator<String> bIter = m_sDepConfigs.keySet().iterator();
          while (bIter.hasNext()) {
              String role = bIter.next();
              ServiceDeploymentRoleConfig bConfig = m_sDepConfigs.get(role);
              write(bConfig, true, skipNonOverrides, writer);
              // per-method roles
              Iterator<String> mIter = bConfig.getMethodConfigs().keySet().iterator();
              while (mIter.hasNext()) {
                  String methodName = mIter.next();
                  MethodRoleConfig mConfig =
                          bConfig.getMethodConfigs().get(methodName);
                  write(mConfig, true, skipNonOverrides, writer);
              }
          }
  
          // closing element for entire doc
          writer.println("</" + _CONFIG + ">");
      }
docs: Serialize to the given writer, keeping it open when finished. If
  skipNonOverrides is true, any configuration whose values are all null
  will not be written.