如何将作家转换为string

Writer writer = new Writer(); String data = writer.toString();/* the value is not casting and displaying null...*/ 

有没有其他方法可以将作者转换为string

如果我想从中创build一个string,我会使用专门的作者。

 Writer writer = new StringWriter(); String data = writer.toString(); // now it works fine 

如果你想要一个结果为StringWriter实现,可以使用StringWriter