gpt4 book ai didi

org.apache.commons.io.output.XmlStreamWriter类的使用及代码示例

转载 作者:知者 更新时间:2024-03-18 06:52:40 27 4
gpt4 key购买 nike

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

XmlStreamWriter介绍

[英]Character stream that handles all the necessary Voodo to figure out the charset encoding of the XML document written to the stream.
[中]字符流,处理所有必要的巫术,以确定写入流的XML文档的字符集编码。

代码示例

代码示例来源:origin: commons-io/commons-io

/**
 * Writes the characters to the underlying writer, detecting encoding.
 *
 * @param cbuf the buffer to write the characters from
 * @param off The start offset
 * @param len The number of characters to write
 * @throws IOException if an error occurs detecting the encoding
 */
@Override
public void write(final char[] cbuf, final int off, final int len) throws IOException {
  if (xmlPrologWriter != null) {
    detectEncoding(cbuf, off, len);
  } else {
    writer.write(cbuf, off, len);
  }
}

代码示例来源:origin: commons-io/commons-io

@Test
public void testEmpty() throws IOException {
  final ByteArrayOutputStream out = new ByteArrayOutputStream();
  final XmlStreamWriter writer = new XmlStreamWriter(out);
  writer.flush();
  writer.write("");
  writer.flush();
  writer.write(".");
  writer.flush();
  writer.close();
}

代码示例来源:origin: commons-io/commons-io

private static void checkXmlContent(final String xml, final String encoding, final String defaultEncoding)
    throws IOException {
  final ByteArrayOutputStream out = new ByteArrayOutputStream();
  final XmlStreamWriter writer = new XmlStreamWriter(out, defaultEncoding);
  writer.write(xml);
  writer.close();
  final byte[] xmlContent = out.toByteArray();
  assertEquals(encoding, writer.getEncoding());
  assertTrue(Arrays.equals(xml.getBytes(encoding), xmlContent));
}

代码示例来源:origin: Nextdoor/bender

/**
 * Write the characters to the underlying writer, detecing encoding.
 * 
 * @param cbuf the buffer to write the characters from
 * @param off The start offset
 * @param len The number of characters to write
 * @throws IOException if an error occurs detecting the encoding
 */
@Override
public void write(char[] cbuf, int off, int len) throws IOException {
  if (xmlPrologWriter != null) {
    detectEncoding(cbuf, off, len);
  } else {
    writer.write(cbuf, off, len);
  }
}

代码示例来源:origin: org.onosproject/onlab-thirdparty

/**
 * Write the characters to the underlying writer, detecing encoding.
 * 
 * @param cbuf the buffer to write the characters from
 * @param off The start offset
 * @param len The number of characters to write
 * @throws IOException if an error occurs detecting the encoding
 */
@Override
public void write(char[] cbuf, int off, int len) throws IOException {
  if (xmlPrologWriter != null) {
    detectEncoding(cbuf, off, len);
  } else {
    writer.write(cbuf, off, len);
  }
}

代码示例来源:origin: io.github.stephenc.docker/docker-client-shaded

/**
 * Write the characters to the underlying writer, detecing encoding.
 * 
 * @param cbuf the buffer to write the characters from
 * @param off The start offset
 * @param len The number of characters to write
 * @throws IOException if an error occurs detecting the encoding
 */
@Override
public void write(final char[] cbuf, final int off, final int len) throws IOException {
  if (xmlPrologWriter != null) {
    detectEncoding(cbuf, off, len);
  } else {
    writer.write(cbuf, off, len);
  }
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

/**
 * Writes the characters to the underlying writer, detecting encoding.
 *
 * @param cbuf the buffer to write the characters from
 * @param off The start offset
 * @param len The number of characters to write
 * @throws IOException if an error occurs detecting the encoding
 */
@Override
public void write(final char[] cbuf, final int off, final int len) throws IOException {
  if (xmlPrologWriter != null) {
    detectEncoding(cbuf, off, len);
  } else {
    writer.write(cbuf, off, len);
  }
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com