标签:转换 void 接受 str java 方法 creat exce sha
1 public void pushEmployee(EmpPushToTianFangRequest request){ 2 try { 3 StringWriter sw = new StringWriter(); 4 JAXBContext context = JAXBContext.newInstance(EmpPushToTianFangRequest.class); 5 Marshaller marshaller = context.createMarshaller(); 6 marshaller.marshal(request, sw); 7 System.out.println(sw.toString()); 8 } catch (JAXBException e) { 9 e.printStackTrace(); 10 } 11 }
1
marshal方法在JDK中的声明:
void javax.xml.bind.Marshaller.marshal(Object jaxbElement, Writer writer) throws JAXBException
使用
StringWriter 接受
Writer
标签:转换 void 接受 str java 方法 creat exce sha
原文地址:http://www.cnblogs.com/ChenJunHacker/p/6216889.html