String.getBytes() function
807603Oct 30 2007 — edited Oct 30 2007I am looking to pass byte arrays over a socket and since the application I am developing is rather high performance, I would like to do it as efficiently as possible
My problem is that in java.lang.String class the getBytes() function accepts a String as a the parameter and returns a byte array, which means everytime i want to convert a string to a byte array it will create a new byte array.
What I would prefer would be to pass the getBytes function a String AND a byte array, then have it place the string into the byte array and return nothing (void)
There appears to be a method that does this but it is depreciated, so I was wondering if anyone knew what is going on behind the scenes so I could write my own or if there is something that I am missing
Thanks!