-
1. Re: String size limitations with TreeCacheMarshaller
clebert.suconic Aug 30, 2006 10:50 AM (in response to manik)If you use writeObject(String) you won't have a limit problem.
writeUTF still using a short on the beggining of a string identifying its size (from DataOutputSomewhere)
On ObjectOUtputStram.writeObject it's done a check on the size of the string, and a flag it's used to defined if it's a small or a big string.
In JavaOutputStream strings are treated without any metadata check, so you wouldn't have a problem calling wirteObject(String) to write these big strings.
If you still want to write a chuncks of String, I had to write my own UTF parser, and on StringUtil@JBossSerialization I can also write smalls or big strings:
http://fisheye.jboss.com/browse/~raw,r=1.11/JBoss/jboss-serialization/src/org/jboss/serial/util/StringUtil.java
Clebert Suconic -
2. Re: String size limitations with TreeCacheMarshaller
manik Aug 30, 2006 11:23 AM (in response to manik)I will be using JBoss Serialization for this, so how would writeObject(String) compare (in terms of size of byte stream) to using writeUTF()?
-
3. Re: String size limitations with TreeCacheMarshaller
clebert.suconic Aug 30, 2006 11:31 AM (in response to manik)It will send something like this:
<ObjectID(integer)><Short|Integer>....
It's very similar to ObjectOutputStream from Java Serialization.
If you want to save 4 bytes from ObjectID you could use StringUtil directly. -
4. Re: String size limitations with TreeCacheMarshaller
manik Aug 31, 2006 7:31 AM (in response to manik)So using StringUtil, I would use StringUtil.saveString(DataOutput, String) and this will write:
<Short|Integer><data...>?
What are the limitations here, then? The largest String would be 2^32 bytes long, i.e., 4GB? -
5. Re: String size limitations with TreeCacheMarshaller
clebert.suconic Aug 31, 2006 12:11 PM (in response to manik)It is actually:
boolean byte (is BigString)
short size if (short String) or long size if (Big String)
bytes for Strings...
it should be integer, but I'm already using long (if big strings)
If you use StringUtil.. use
StringUtil.saveString(dataOutput,String)
and
StringUtil.readString(dataInput,null); (I was supposed to create an overload here, but null will work here)
If you want/need to move the class to some common project, I'm fine with that.