Andy,

I am not sure how to do this exactly, but maybe something along the lines
of:

ArrayLen( CreateObject("java", "java.lang.String").Init( strFileContent
).GetBytes() )

It creates a string, then gets the byte array (as described in the java
docs: "Convert this String into bytes according to the platform's default
character encoding, storing the result into a new byte array."). Perhaps in
this case, the number of bytes would be the size of the memory??

.......................
Ben Nadel 
Web Developer
Nylon Technology
350 7th Ave.
Suite 1005
New York, NY 10001
212.691.1134 x 14
212.691.3477 fax
www.nylontechnology.com

Sanders: Lightspeed too slow?
Helmet: Yes we'll have to go right to ludacris speed.
-----Original Message-----
From: Andy Matthews [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 19, 2006 10:03 AM
To: CF-Talk
Subject: RE: Get String Byte Size

I would think that at the Java level there would be some way to get the
"size" of a variable.

Maybe these might help?:
http://www.roseindia.net/javatutorials/determining_memory_usage_in_java.shtm
l

http://gcc.gnu.org/ml/java/2003-02/msg00293.html


<!----------------//------
andy matthews
web developer
ICGLink, Inc.
[EMAIL PROTECTED]
615.370.1530 x737
--------------//--------->

-----Original Message-----
From: Rob Wilkerson [mailto:[EMAIL PROTECTED]
Sent: Wednesday, April 19, 2006 8:57 AM
To: CF-Talk
Subject: Re: Get String Byte Size


And therein lies the key.  I may - or may not - have unicode involved.
 I was hoping someone knew of some quick java to return the byte size of a
string that would handle those vagaries.  I haven't found anything in my
searches.

On 4/19/06, Ben Nadel <[EMAIL PROTECTED]> wrote:
> Rob,
>
> Characters take up one byte... As far as I know... Althoug unicode may
take
> up 4?? I can't remember. I suppose the best estimate would be to 
> multiply the string length by the byte size of each characters:
>
> intSizeEstimate = Len( strFileContent ) * 4
>
> -b
> .......................
> Ben Nadel
> Web Developer
> Nylon Technology
> 350 7th Ave.
> Suite 1005
> New York, NY 10001
> 212.691.1134 x 14
> 212.691.3477 fax
> www.nylontechnology.com
>
> Sanders: Lightspeed too slow?
> Helmet: Yes we'll have to go right to ludacris speed.
> -----Original Message-----
> From: Rob Wilkerson [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, April 19, 2006 9:28 AM
> To: CF-Talk
> Subject: Get String Byte Size
>
> Anyone have any quick code to retrieve the number of bytes in a string 
> /without/ writing the string to a file first?  I'm trying to do a 
> little debugging and I'd like to know the size of a string that is 
> being returned to the browser.
>
> Thanks.
>
> --
>
> Rob Wilkerson
>
>
>
>





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:238086
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to