EJP wrote:i admit this is a little nebulous, but if you look at the javadoc for "readUTF" is says "+modified+ UTF-8" (ala DataInputStream). i randomly grabbed the source for jboss messaging and their implementation of this method uses DataInputStream.readUTF. lastly, the first 2 chars of an xml doc (which are missing in the OP's example) are "<?", which is 15423 when converted to a short (~16k).
I think jtahlborn may be confusing BytesMessage.readUTF() with DataInputStream.readUTF(), which reads a very specific format that is only written by DataOutputStream.writeUTF().
qjvictor wrote:first of all, i already indicated that you shouldn't be converting your xml data to a String! also, i'm not sure why you think readUTF would be faster than readBytes (considering the underlying data is bytes)? just read the bytes and parse as xml and skip the whole string thing (it will be faster to parse the xml from bytes than converting bytes to a String and then parsing as xml).
Anybody could tell me the margin size of readUTF limit, because in my case, majority xmls are fine, only big one has the problem.
I am considering a solution like 'less than the size, using readUTF, otherwise, readBytes'
also if I am using readBytes, any performance loss?
And if there is no performance diff comparing with readUTF and readBytes, I will definitely go to readBytes instead of readUTF.It is meaningless to compare the performance of a working solution with the performance of a non-working solution.