1 28 29 package com.caucho.server.connection; 30 31 import com.caucho.log.Log; 32 import com.caucho.util.L10N; 33 34 import java.io.IOException ; 35 import java.io.OutputStream ; 36 import java.util.logging.Logger ; 37 38 public class StreamWrapperResponseStream extends ToByteResponseStream { 39 static final Logger log = Log.open(StreamWrapperResponseStream.class); 40 41 static final L10N L = new L10N(StreamWrapperResponseStream.class); 42 43 private OutputStream _os; 44 45 public StreamWrapperResponseStream() 46 { 47 } 48 49 public void init(OutputStream os) 50 { 51 _os = os; 52 } 53 54 61 protected void writeNext(byte []buf, int offset, int length, boolean isEnd) 62 throws IOException 63 { 64 if (_os != null) 65 _os.write(buf, offset, length); 66 } 67 68 71 public void flush() 72 throws IOException 73 { 74 flushBuffer(); 75 76 if (_os != null) 77 _os.flush(); 78 } 79 80 83 public void finish() 84 throws IOException 85 { 86 flushBuffer(); 87 88 95 96 _os = null; 97 } 98 99 102 public void close() 103 throws IOException 104 { 105 super.close(); 106 107 114 115 _os = null; 116 } 117 } 118 | Popular Tags |