Prasad Moganna Gowda wrote:
>
> Hi All,
>
> Our project uses distributed objects, basically the servlets talk to another
> java application
> on a different m/c. through RMI. One of the method calls to the RMI
> applications returns us
> a string object. What I wanted to know, is there any limitation on the
> length of the string
> that can be passed from the RMI server to the servlet. The RMI server is
> querying the database
> and returning back the results in a string object.
Strings sent over RMI are limited to something between approximately 20K and 64K
characters. Strings are serialized using UTF8 representation, which means that 1
to 3 bytes will be used for every character. The DataOutputStream class checks
how many bytes will be needed to serialize the String, and if that count exceeds
65535, it throws a UTFDataFormatException.
chars between 0x0001 and 0x007f use 1 byte
chars between 0x0080 and 0x07ff use 2 bytes
chars greater than 0x07ff use 3 bytes
So, if your String contains characters only ASCII characters from ASCII 1 to
ASCII 127, you should be able to serialize a String containin 65535 characters.
If your String contains all characters greater than 0x07ff, then your String is
limited to 21845 characters.
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