我試圖把一些字符串放到CharBuffer
與CharBuffer.put()
函數 但緩衝區留空。CharBuffer.put()沒有工作
我的代碼:
CharBuffer charBuf = CharBuffer.allocate(1000);
for (int i = 0; i < 10; i++)
{
String text = "testing" + i + "\n";
charBuf.put(text);
}
System.out.println(charBuf);
我試圖allocate(1000)
後clear()
或rewind()
使用,但並沒有改變結果。