org.dom4j.io.OutputFormat.getEncoding()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(143)

本文整理了Java中org.dom4j.io.OutputFormat.getEncoding()方法的一些代码示例,展示了OutputFormat.getEncoding()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OutputFormat.getEncoding()方法的具体详情如下:
包路径:org.dom4j.io.OutputFormat
类名称:OutputFormat
方法名:getEncoding

OutputFormat.getEncoding介绍

暂无

代码示例

代码示例来源:origin: igniterealtime/Openfire

/**
 * Returns the maximum allowed character code that should be allowed
 * unescaped which defaults to 127 in US-ASCII (7 bit) or
 * 255 in ISO-* (8 bit).
 */
protected int defaultMaximumAllowedCharacter() {
  String encoding = format.getEncoding();
  if (encoding != null) {
    if (encoding.equals("US-ASCII")) {
      return 127;
    }
  }
  // no encoding for things like ISO-*, UTF-8 or UTF-16
  return -1;
}

代码示例来源:origin: igniterealtime/Openfire

public void setOutputStream(OutputStream out) throws UnsupportedEncodingException {
  this.writer = createWriter(out, format.getEncoding());
  this.autoFlush = true;
}

代码示例来源:origin: com.thoughtworks.xstream/xstream

public HierarchicalStreamWriter createWriter(final OutputStream out) {
  final String encoding = getOutputFormat() != null ? getOutputFormat().getEncoding() : null;
  final Charset charset = encoding != null && Charset.isSupported(encoding) ? Charset.forName(encoding) : null;
  final Writer writer = charset != null ? new OutputStreamWriter(out, charset) : new OutputStreamWriter(out);
  return createWriter(writer);
}

代码示例来源:origin: igniterealtime/Openfire

public XMLWriter(OutputStream out) throws UnsupportedEncodingException {
  this.format = DEFAULT_FORMAT;
  this.writer = createWriter(out, format.getEncoding());
  this.autoFlush = true;
  namespaceStack.push(Namespace.NO_NAMESPACE);
}

代码示例来源:origin: igniterealtime/Openfire

public XMLWriter(OutputFormat format) throws UnsupportedEncodingException {
  this.format = format;
  this.writer = createWriter( System.out, format.getEncoding() );
  this.autoFlush = true;
  namespaceStack.push(Namespace.NO_NAMESPACE);
}

代码示例来源:origin: igniterealtime/Openfire

public XMLWriter(OutputStream out, OutputFormat format) throws UnsupportedEncodingException {
  this.format = format;
  this.writer = createWriter(out, format.getEncoding());
  this.autoFlush = true;
  namespaceStack.push(Namespace.NO_NAMESPACE);
}

代码示例来源:origin: igniterealtime/Openfire

/**
 * <p>
 * This will write the declaration to the given Writer.
 *   Assumes XML version 1.0 since we don't directly know.
 * </p>
 */
protected void writeDeclaration() throws IOException {
  String encoding = format.getEncoding();
  // Only print of declaration is not suppressed
  if (! format.isSuppressDeclaration()) {
    // Assume 1.0 version
    if (encoding.equals("UTF8")) {
      writer.write("<?xml version=\"1.0\"");
      if (!format.isOmitEncoding()) {
        writer.write(" encoding=\"UTF-8\"");
      }
      writer.write("?>");
    } else {
      writer.write("<?xml version=\"1.0\"");
      if (! format.isOmitEncoding()) {
        writer.write(" encoding=\"" + encoding + "\"");
      }
      writer.write("?>");
    }
    if (format.isNewLineAfterDeclaration()) {
      println();
    }
  }
}

代码示例来源:origin: org.dom4j/dom4j

/**
 * Returns the maximum allowed character code that should be allowed
 * unescaped which defaults to 127 in US-ASCII (7 bit) or 255 in ISO- (8
 * bit).
 * 
 * @return DOCUMENT ME!
 */
protected int defaultMaximumAllowedCharacter() {
  String encoding = format.getEncoding();
  if (encoding != null) {
    if (encoding.equals("US-ASCII")) {
      return 127;
    }
  }
  // no encoding for things like ISO-*, UTF-8 or UTF-16
  return -1;
}

代码示例来源:origin: org.dom4j/dom4j

public void setOutputStream(OutputStream out)
    throws UnsupportedEncodingException {
  this.writer = createWriter(out, format.getEncoding());
  this.autoFlush = true;
}

代码示例来源:origin: org.dom4j/dom4j

public XMLWriter(OutputStream out) throws UnsupportedEncodingException {
  this.format = DEFAULT_FORMAT;
  this.writer = createWriter(out, format.getEncoding());
  this.autoFlush = true;
  namespaceStack.push(Namespace.NO_NAMESPACE);
}

代码示例来源:origin: org.dom4j/dom4j

public XMLWriter(OutputStream out, OutputFormat format)
    throws UnsupportedEncodingException {
  this.format = format;
  this.writer = createWriter(out, format.getEncoding());
  this.autoFlush = true;
  namespaceStack.push(Namespace.NO_NAMESPACE);
}

代码示例来源:origin: org.dom4j/dom4j

public XMLWriter(OutputFormat format) throws UnsupportedEncodingException {
  this.format = format;
  this.writer = createWriter(System.out, format.getEncoding());
  this.autoFlush = true;
  namespaceStack.push(Namespace.NO_NAMESPACE);
}

代码示例来源:origin: org.dom4j/dom4j

String encoding = format.getEncoding();

代码示例来源:origin: dom4j/dom4j

public void setOutputStream(OutputStream out)
    throws UnsupportedEncodingException {
  this.writer = createWriter(out, format.getEncoding());
  this.autoFlush = true;
}

代码示例来源:origin: x-stream/xstream

@SuppressWarnings("resource")
@Override
public HierarchicalStreamWriter createWriter(final OutputStream out) {
  final String encoding = getOutputFormat() != null ? getOutputFormat().getEncoding() : null;
  final Charset charset = encoding != null && Charset.isSupported(encoding) ? Charset.forName(encoding) : null;
  final Writer writer = charset != null ? new OutputStreamWriter(out, charset) : new OutputStreamWriter(out);
  return createWriter(writer);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.xstream

public HierarchicalStreamWriter createWriter(final OutputStream out) {
  final String encoding = getOutputFormat() != null ? getOutputFormat().getEncoding() : null;
  final Charset charset = encoding != null && Charset.isSupported(encoding) ? Charset.forName(encoding) : null;
  final Writer writer = charset != null ? new OutputStreamWriter(out, charset) : new OutputStreamWriter(out);
  return createWriter(writer);
}

代码示例来源:origin: dom4j/dom4j

public XMLWriter(OutputStream out) throws UnsupportedEncodingException {
  this.format = DEFAULT_FORMAT;
  this.writer = createWriter(out, format.getEncoding());
  this.autoFlush = true;
  namespaceStack.push(Namespace.NO_NAMESPACE);
}

代码示例来源:origin: dom4j/dom4j

public XMLWriter(OutputFormat format) throws UnsupportedEncodingException {
  this.format = format;
  this.writer = createWriter(System.out, format.getEncoding());
  this.autoFlush = true;
  namespaceStack.push(Namespace.NO_NAMESPACE);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.dom4j

public XMLWriter(OutputStream out, OutputFormat format)
    throws UnsupportedEncodingException {
  this.format = format;
  this.writer = createWriter(out, format.getEncoding());
  this.autoFlush = true;
  namespaceStack.push(Namespace.NO_NAMESPACE);
}

代码示例来源:origin: dom4j/dom4j

public XMLWriter(OutputStream out, OutputFormat format)
    throws UnsupportedEncodingException {
  this.format = format;
  this.writer = createWriter(out, format.getEncoding());
  this.autoFlush = true;
  namespaceStack.push(Namespace.NO_NAMESPACE);
}

相关文章