Hi,
At the moment I have following code:
public void run()
{
while (true)
// here collecting data
StringBuffer tx = new StringBuffer(128);
tx.append(...);
// sending the data to some remote peer
This is of course not good. Every time new memory is allocated, while it is better to reuse the memory whitch has a stable point after a few loops. But then I need a method to clear the buffer witch I cannot find. Something like this:
public void run()
{
StringBuffer tx = new StringBuffer(128);
while (true)
// here collecting data
tx.clear(); // but I connot find sutch a method !!!
tx.append(...);
// sending the data to some remote peer
But I cannot find a method Clear or something similar. Someone knows ?