public static void main(String[] args) throws Exception {
String str = "www.baidu.com";
PushbackInputStream push = null;
ByteArrayInputStream bai = null;
bai = new ByteArrayInputStream(str.getBytes());
push = new PushbackInputStream(bai);
int temp;
while((temp=push.read())!=-1){
if(temp=='.'){
push.unread(temp);
temp=push.read();
System.out.println("(退回"+(char)temp+")");
}else{
System.out.println((char)temp);
}
}
}
转载于:https://my.oschina.net/liangxiao/blog/123515