gpt4 book ai didi

play.libs.XML.fromInputStream()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-22 22:27:05 26 4
gpt4 key购买 nike

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

XML.fromInputStream介绍

[英]Parse an InputStream as DOM.
[中]

代码示例

代码示例来源:origin: com.typesafe.play/play_2.10

/**
 * Parse an XML string as DOM.
 */ 
public static Document fromString(String xml) {
  try {
    return fromInputStream(
      new ByteArrayInputStream(xml.getBytes("utf-8")),
      "utf-8"
    );
  } catch(UnsupportedEncodingException e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: com.typesafe.play/play

/**
 * Parses an XML string as DOM.
 *
 * @param xml the input XML string
 * @return the parsed XML DOM root.
 */
public static Document fromString(String xml) {
  try {
    return fromInputStream(
        new ByteArrayInputStream(xml.getBytes("utf-8")),
        "utf-8"
    );
  } catch (UnsupportedEncodingException e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: com.typesafe.play/play_2.11

/**
 * Parses an XML string as DOM.
 *
 * @param xml the input XML string
 * @return the parsed XML DOM root.
 */
public static Document fromString(String xml) {
  try {
    return fromInputStream(
        new ByteArrayInputStream(xml.getBytes("utf-8")),
        "utf-8"
    );
  } catch (UnsupportedEncodingException e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: com.typesafe.play/play_2.12

/**
 * Parses an XML string as DOM.
 *
 * @param xml the input XML string
 * @return the parsed XML DOM root.
 */
public static Document fromString(String xml) {
  try {
    return fromInputStream(
        new ByteArrayInputStream(xml.getBytes("utf-8")),
        "utf-8"
    );
  } catch (UnsupportedEncodingException e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: com.typesafe.play/play

@Override
  protected Document parse(Http.RequestHeader request, ByteString bytes) throws Exception {
    return XML.fromInputStream(bytes.iterator().asInputStream(), request.charset().orElse(null));
  }
}

代码示例来源:origin: com.typesafe.play/play_2.12

@Override
  protected Document parse(Http.RequestHeader request, ByteString bytes) throws Exception {
    return XML.fromInputStream(bytes.iterator().asInputStream(), request.charset().orElse(null));
  }
}

代码示例来源:origin: com.typesafe.play/play_2.11

@Override
  protected Document parse(Http.RequestHeader request, ByteString bytes) throws Exception {
    return XML.fromInputStream(bytes.iterator().asInputStream(), request.charset().orElse(null));
  }
}

代码示例来源:origin: play/play-java

/**
 * Get the response body as a {@link Document DOM document}
 * @return a DOM document
 */
public Document asXml() {
  try {
    return play.libs.XML.fromInputStream(ahcResponse.getResponseBodyAsStream(), "utf-8");
  } catch (IOException e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: com.typesafe.play/play-java-ws

/**
 * Get the response body as a {@link Document DOM document}
 *
 * @return a DOM document
 */
@Override
public Document asXml() {
  String contentType = contentType();
  Charset charset = HttpUtils.parseCharset(contentType);
  if (charset == null) {
    charset = StandardCharsets.UTF_8;
  }
  return play.libs.XML.fromInputStream(ahcResponse.getResponseBodyAsStream(), charset.name());
}

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