package com.meson.pushinputstream;import java.io.ByteArrayInputStream;import java.io.IOException;import java.io.PushbackInputStream;/** * Created by Administrator on 2014-11-21. */public class PushInputStreamDemo { public static void main(String[] args) throws IOException{ String str = "www.mltmeson.com"; PushbackInputStream push = null;// ByteArrayInputStream bai = null; bai = new ByteArrayInputStream(str.getBytes()); push = new PushbackInputStream(bai); System.out.println("读取之后的数据为:"); int temp = 0; while((temp = push.read())!= - 1){ if(temp == '.'){ push.unread(temp); temp = push.read(); System.out.println("(退回"+(char)temp+")"); } else{ System.out.println((char)temp); } } }}