No, that returns the numer of characters that are in the string.  The 
length of the byte array returned by the various String.getBytes() 
methods is the content length.

(If the encoding is an 8-bit encoding or UTF-8 then the length is the 
content length, but for multi-byte characters such as any asian glyph or 
a 2 byte encoding then it isn't).

--Danno

Pilho Kim wrote:

> Hi, Costin
> 
> If you want to get Content-Length,
> is String.length() valid or not ?
> 
> Tomcat dvelopers, containg you, must know this.
> 
> Kim.
> 
> 
> 
> On Wed, 6 Dec 2000, Costin Manolache wrote:
> 
> 
>> One problem I have with the patches ( and I sent a 
>> reply to Pilho Kim the first time he posted the
>> patches) is the impact on performances.
>> 
>> The least we can do is to detect if the encoding is 
>> compatible with ASCII ( or UNICODE ) and use the
>> getBytes() only if it isn't. The method has a big
>> impact on all VMs - try it if you don't believe me.
>> 
>> In tomcat3.3 OutputBuffer tries to resolve exactly
>> that problem ( char->byte ), and seems to work well,
>> but we need more work to convert header values, etc.
>> ( i.e. for 3.3 the patch shouldn't be needed, the
>> problem is supposed to be solved by OutputBuffer ).
>> 
>> This is a very delicate subject from the point of view
>> of performance, and I spent a lot of time tunning
>> tomcat -> I would like to review any patch on encoding
>> before it is commited.
>> 
>> Costin
>> 
>> 


Reply via email to