1 28 29 package com.caucho.vfs; 30 31 import java.io.BufferedReader ; 32 import java.io.IOException ; 33 34 39 public class BufferedReaderAdapter extends BufferedReader { 40 private ReadStream rs; 41 42 public BufferedReaderAdapter(ReadStream rs) 43 { 44 super(rs.getReader(), 1); 46 } 47 48 public void init(ReadStream rs) 49 { 50 this.rs = rs; 51 } 52 53 public int read() throws IOException 54 { 55 return rs.readChar(); 56 } 57 58 public int read(char []cbuf, int offset, int length) throws IOException 59 { 60 return rs.read(cbuf, offset, length); 61 } 62 63 public String readLine() throws IOException 64 { 65 return rs.readln(); 66 } 67 68 public long skip(long n) throws IOException 69 { 70 long count = 0; 71 72 for (; count < n && rs.readChar() >= 0; count++) { 73 } 74 75 return count; 76 } 77 78 public boolean ready() throws IOException 79 { 80 return rs.available() > 0; 81 } 82 83 public void close() throws IOException 84 { 85 } 86 } 87 | Popular Tags |