XmlHashMapBodyWriter.java 文件源码

java
阅读 18 收藏 0 点赞 0 评论 0

项目:Nasapi 作者:
@Override
public void writeTo(HashMap hashMap, Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> multivaluedMap, OutputStream outputStream) throws IOException, WebApplicationException {
    try {
        XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
        XMLStreamWriter xmlWriter = outputFactory.createXMLStreamWriter(outputStream);
        xmlWriter.writeStartElement("entity");
        writeValue(hashMap, xmlWriter);
        xmlWriter.writeEndElement();
        xmlWriter.flush();
        xmlWriter.close();
    } catch (XMLStreamException e) {
        throw new IOException(e);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号