[jmsl] Getting MusicShape from PHP

jmsl at music.columbia.edu jmsl at music.columbia.edu
Mon Apr 13 18:07:09 EDT 2009


Hi Chi,

You might also use StringBuilder instead of += with string.  If you  
have a file with 1000 lines, using += will create 1000 strings (since  
strings are immutable) and chew up memory.  Using StringBuilder will  
only create the string at the end, saving you memory.  Sample code  
below.

StringBuilder input = new StringBuilder();

try {

BufferedReader br = new BufferedReader(new  
InputStreamReader(httpUrlConnection.getInputStream()));

String line;

while ((line = br.readLine()) != null)

input.append(line);

br.close();

}

String outString = input.toString();





More information about the jmsl mailing list