2009-02-19 7 views

답변

25

StringWriterStream이 아니기 때문에 StringWriterWriter이므로 정확하게 입력 할 수 없습니다. 하지만 다음과 같이 할 수 있습니다.

// create a ByteArray stream, which will be wrapped by a PrintStream 
ByteArrayOutputStream baos = new ByteArrayOutputStream(); 
PrintStream ps = new PrintStream(baos); 
System.setOut(ps); 

// print whatever you got 
String result = baos.toString(); 
+1

+1 플러스 내 중복 게시물 삭제 – toolkit

관련 문제