Beispiel #1
0
 public String getContent() {
   try {
     tmpWriter.flush(); // 刷新该流的缓冲,详看java.io.Writer.flush()
     String s = tmpWriter.getByteArrayOutputStream().toString("UTF-8");
     // 此处可根据需要进行对输出流以及Writer的重置操作
     // 比如tmpWriter.getByteArrayOutputStream().reset()
     return s;
   } catch (UnsupportedEncodingException e) {
     return "UnsupportedEncoding";
   }
 }
Beispiel #2
0
 public void close() throws IOException {
   tmpWriter.close();
 }
Beispiel #3
0
 public void finalize() throws Throwable {
   super.finalize();
   output.close();
   tmpWriter.close();
 }