1 28 29 package com.caucho.server.connection; 30 31 import javax.servlet.ServletInputStream ; 32 import java.io.IOException ; 33 import java.io.InputStream ; 34 35 public class ServletInputStreamImpl extends ServletInputStream { 36 private InputStream _is; 37 38 public ServletInputStreamImpl() 39 { 40 } 41 42 public void init(InputStream is) 43 { 44 _is = is; 45 } 46 47 public int available() throws IOException 48 { 49 if (_is == null) 50 return -1; 51 else 52 return _is.available(); 53 } 54 55 60 public int read() throws IOException 61 { 62 if (_is == null) 63 return -1; 64 else 65 return _is.read(); 66 } 67 68 public int read(byte []buf, int offset, int len) throws IOException 69 { 70 if (_is == null) 71 return -1; 72 else 73 return _is.read(buf, offset, len); 74 } 75 76 public long skip(long n) throws IOException 77 { 78 if (_is == null) 79 return -1; 80 else 81 return _is.skip(n); 82 } 83 84 public void close() throws IOException 85 { 86 } 87 88 public void free() 89 { 90 _is = null; 91 } 92 } 93 | Popular Tags |