1 package com.quadcap.io; 2 3 40 41 import java.io.*; 42 43 import com.quadcap.util.Debug; 44 import com.quadcap.util.Util; 45 46 51 52 public class TraceOutputStream extends OutputStream { 53 OutputStream out; 54 55 public TraceOutputStream(OutputStream os) { 56 this.out = os; 57 } 58 59 public void write(int b) throws IOException { 60 out.write(b); 61 Debug.println("write: " + b + " [" + Integer.toHexString(b) + "]"); 62 } 63 64 public void write(byte[] buf, int offset, int len) throws IOException { 65 out.write(buf, offset, len); 66 Debug.println("write: " + Util.strBytes(buf, offset, len)); 67 } 68 69 public void write(byte[] buf) throws IOException { 70 out.write(buf); 71 Debug.println("write: " + Util.strBytes(buf)); 72 } 73 74 public void flush() throws IOException { 75 Debug.println("flush"); 76 out.flush(); 77 } 78 79 public void close() throws IOException { 80 out.close(); 81 } 82 83 } 84 | Popular Tags |