I don't understand why there has to be a restriction on the size limit (64K) of the
String that is to be serialized. The problem comes when we try to serialize it, can
a String contain more than 64K characters.

Ravi

Kevin Mukhar wrote:

> Ravi Sankar Pabbati wrote:
> >
> > I had the same problem with Strings in serialization. I think the limit is
> > around 60000 characters in a string that is to be serialized.
>
> A String is serialized using the DataOutputStream class. This class converts the
> String to its UTF representation. It also counts the number of bytes needed for
> the UTF representation, and if that number is greater than 65535 (jdk1.1.7,
> probably 1.2 and 1.3 as well, but I don't have the source to check those), then
> it throws a UTFDataFormatException.
>
> So the limit is not 60000 chars, or even 64K chars, its the number of chars that
> fit into 64K bytes. If all your chars fall in the range of 0x0000 to 0c007F
> (basically the first 128 chars in the ASCII set) then you can indeed get 64K
> chars. If all your chars are in the range of 0x0800 to 0xffff, then each char
> requires three UTF bytes, and you will be limited to a bit more than 21K chars.
> If you have a mix of chars, you'll get something in between 21K and 64K chars.
>
> K Mukhar
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

--
______________________________________________________________
Ravi Sankar Pabbati,
Wipro GE Medical Systems,
A-1, Golden Enclave, Airport Road, Bangalore,
India - 560 017.
Tel : (91)-(80)-5263121 ext 344 ; Fax :  (91)-(80)-5263520
Visit us on the Internet :  http://www.gemedicalsystems.com
http://www.wiproge.com

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to