Java.io.BufferedReader.ready() 方法 Java.io.BufferedOutputStream.Write(int, int) 方法 Java.io.BufferedReader.reset() 方法 Java.io.BufferedReader.ready() 方法 package com.codingdict; import java.io.BufferedReader; import java.io.StringReader; import java.nio.CharBuffer; public class BufferedReaderDemo { public static void main(String[] args) throws Exception { String s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; StringReader sr = null; BufferedReader br = null; try { sr = new StringReader(s); // create new buffered reader br = new BufferedReader(sr); // Destination source is created CharBuffer target = CharBuffer.allocate(s.length()); // ready is invoked to test if character stream is ready if(br.ready()) { br.read(target); } System.out.print(target.array()); } catch(Exception e) { e.printStackTrace(); } finally { // releases resources associated with the streams if(br!=null) br.close(); } } } Java.io.BufferedOutputStream.Write(int, int) 方法 Java.io.BufferedReader.reset() 方法