本文整理了Java中play.libs.XML.fromInputStream()
方法的一些代码示例,展示了XML.fromInputStream()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XML.fromInputStream()
方法的具体详情如下:
包路径:play.libs.XML
类名称: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());
}
内容来源于网络,如有侵权,请联系作者删除!