1 22 package org.jboss.test.invokers.ejb; 23 24 import java.io.InputStream ; 25 import java.io.IOException ; 26 import java.io.OutputStream ; 27 import java.net.Socket ; 28 import java.util.zip.GZIPInputStream ; 29 import java.util.zip.GZIPOutputStream ; 30 31 41 class CompressionSocket extends Socket 42 { 43 44 45 private InputStream in; 46 47 private OutputStream out; 48 49 52 public CompressionSocket() 53 { 54 super(); 55 } 56 57 60 public CompressionSocket(String host, int port) throws IOException 61 { 62 super(host, port); 63 } 64 65 68 public InputStream getInputStream() throws IOException 69 { 70 if (in == null) 71 { 72 in = new CompressionInputStream(super.getInputStream()); 73 } 74 return in; 75 } 76 77 80 public OutputStream getOutputStream() throws IOException 81 { 82 if (out == null) 83 { 84 out = new CompressionOutputStream(super.getOutputStream()); 85 } 86 return out; 87 } 88 89 93 public synchronized void close() throws IOException 94 { 95 OutputStream o = getOutputStream(); 96 o.flush(); 97 super.close(); 98 } 99 } 100 | Popular Tags |