I try to put some strings to CharBuffer with CharBuffer.put() function
but the buffer is left blank.
my code:
CharBuffer charBuf = CharBuffer.allocate(1000);
for (int i = 0; i < 10; i++)
{
String text = "testing" + i + "\n";
charBuf.put(text);
}
System.out.println(charBuf);
I tried to use with clear() or rewind() after allocate(1000) but that did not change the result.
You must rewind it after you put in the objects, try this