java - JAXB Marshal does not convert the separator from a byte array -
i need create xml file. have pdf document converted byte array:
document.setcontent(base64.encode(filedata,true).getbytes(charset.forname("utf-8")));
in method base64.encode(filedata,true) - "true" parameter set line separator every 76 characters.
then next code:
file file = new file("c:\\123.xml"); fileoutputstream tmpstream = new fileoutputstream(file); getmarshaller(contextpath).marshal(jaxbelement, tmpstream); author out = new bufferedwriter(new outputstreamwriter(tmpstream)); out.flush(); out.close();
the final result in file without separator:
<document> <content>slzcrvjpmhhmak1osmvmano5tu5damcysurbz2iysnfeuw84uenbdlrhbhvav0z5yvhwbfpdqxhjqtb2venbek5qqtboemnnrfm5sq0ksuzzz09estvjrel3twlczelbmhzueue0t1nbtkwwvwdnv</content> </document>
i can not understand why. can help?
check "end-of-line handling" section here. first of all, suggest replace crlf " " (unicode character line feed) prior writing xml file.
java arrays xml jaxb byte
No comments:
Post a Comment