try{
InputStream myIn=new ByteArrayInputStream(txt.getBytes());
//将System.in转化为面向字符的流
InputStreamReader ir = new InputStreamReader(myIn);
in = new BufferedReader(ir);//为输入流提供缓冲区
while ((s = in.readLine()) != "bye")
System.out.println("Read: " + s);
}
catch(IOException e)
{System.out.println("Error! ");}
}
Java如何把字符串转化为输入流
猜你喜欢
转载自dwdwgo.iteye.com/blog/2345136
今日推荐
周排行