1 29 30 package com.caucho.vfs; 31 32 import java.io.IOException ; 33 import java.io.InputStream ; 34 35 38 public class StreamImplInputStream extends InputStream { 39 private StreamImpl _stream; 40 private byte []_buf = new byte[1]; 41 42 public StreamImplInputStream(StreamImpl stream) 43 { 44 _stream = stream; 45 } 46 47 52 public int read() 53 throws IOException 54 { 55 int len = _stream.read(_buf, 0, 1); 56 57 if (len == 1) 58 return _buf[0] & 0xff; 59 else 60 return -1; 61 } 62 63 70 public int read(byte []buffer, int offset, int length) 71 throws IOException 72 { 73 return _stream.read(buffer, offset, length); 74 } 75 76 79 public void close() throws IOException 80 { 81 _stream.close(); 82 } 83 } 84 | Popular Tags |