Change jString length and content without realocating new memory?
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Nicol_Saraova
Posted On:   Tuesday, July 25, 2006 01:21 PM

I have class SourceSpecificMulticastSocket and method : receive(String datagram); (it will be another class - Datagram - containing IP adresses also, but for simplicity) where variable datagram is to be replaced by another string. One way is to release old one: (*env)->ReleaseStringUTFChars(env, prompt, str); And allocate new: (*env)->NewStringUTF(env, inbuf); But I am not really sure about its performance hit. ------------------------------------- #### My QUESTION #1 ######## Is it possible to change content of String and its length? #### My QUESTION #2 #####   More>>

I have class SourceSpecificMulticastSocket and method :



receive(String datagram); (it will be another class - Datagram - containing IP adresses also, but for simplicity)



where variable datagram is to be replaced by another string.



One way is to release old one:

(*env)->ReleaseStringUTFChars(env, prompt, str);



And allocate new:

(*env)->NewStringUTF(env, inbuf);



But I am not really sure about its performance hit.

-------------------------------------

#### My QUESTION #1 ########

Is it possible to change content of String and its length?



#### My QUESTION #2 ########

If no, any idea?



-------

BTW: My project will be released as opensource under commercial-frieendly Apache licence on
http://jssm.dev.java.net soon.

   <<Less
About | Sitemap | Contact