1 30 31 package org.ofbiz.service.rmi.socket.zip; 32 33 import java.io.IOException ; 34 import java.io.InputStream ; 35 import java.io.OutputStream ; 36 import java.net.Socket ; 37 38 class CompressionSocket extends Socket { 39 40 41 private InputStream in; 42 43 private OutputStream out; 44 45 48 public CompressionSocket() { 49 super(); 50 } 51 52 55 public CompressionSocket(String host, int port) throws IOException { 56 super(host, port); 57 } 58 59 62 public InputStream getInputStream() throws IOException { 63 if (in == null) { 64 in = new CompressionInputStream(super.getInputStream()); 65 } 66 return in; 67 } 68 69 72 public OutputStream getOutputStream() throws IOException { 73 if (out == null) { 74 out = new CompressionOutputStream(super.getOutputStream()); 75 } 76 return out; 77 } 78 79 83 public synchronized void close() throws IOException { 84 OutputStream o = getOutputStream(); 85 o.flush(); 86 super.close(); 87 } 88 } 89 | Popular Tags |