1 31 32 package org.apache.commons.httpclient; 33 34 import java.io.FilterInputStream ; 35 import java.io.IOException ; 36 import java.io.InputStream ; 37 38 47 48 class WireLogInputStream extends FilterInputStream { 49 50 51 private InputStream in; 52 53 54 private Wire wire; 55 56 61 public WireLogInputStream(InputStream in, Wire wire) { 62 super(in); 63 this.in = in; 64 this.wire = wire; 65 } 66 70 public int read(byte[] b, int off, int len) throws IOException { 71 int l = this.in.read(b, off, len); 72 if (l > 0) { 73 wire.input(b, off, l); 74 } 75 return l; 76 } 77 78 82 public int read() throws IOException { 83 int l = this.in.read(); 84 if (l > 0) { 85 wire.input(l); 86 } 87 return l; 88 } 89 90 94 public int read(byte[] b) throws IOException { 95 int l = this.in.read(b); 96 if (l > 0) { 97 wire.input(b, 0, l); 98 } 99 return l; 100 } 101 } 102 | Popular Tags |