字符内存流:
package com.qyl.test;
import java.io.CharArrayReader;
import java.io.CharArrayWriter;
import java.io.IOException;
import org.junit.Test;
public class CharArrayReade {
@Test
public void test1 () throws Exception {
CharArrayWriter ch = new CharArrayWriter();
ch.write("hello".toCharArray());
char[] a = ch.toCharArray();
System.out.println(a);
CharArrayReader cr=new CharArrayReader(a);
char[] buf = new char[1024];
int len;
while((len=cr.read(buf))!=-1) {
System.out.print(new String(buf,0,len));
}
}
}
原文章:https://blog.csdn.net/qq_21992025/article/details/73024372