1 14 package org.wings.io; 15 16 import java.io.IOException ; 17 import java.io.OutputStream ; 18 import java.util.zip.GZIPOutputStream ; 19 20 56 public final class GZIPCompressingDevice implements Device { 57 private final OutputStreamDevice deligee; 58 59 public GZIPCompressingDevice(OutputStream out) throws IOException { 60 deligee = new OutputStreamDevice(new GZIPOutputStream (out)); 61 } 62 63 public GZIPCompressingDevice(Device d) throws IOException { 64 this(new DeviceOutputStream(d)); 65 } 66 67 71 public boolean isSizePreserving() { return false; } 72 73 public void flush() throws IOException { 75 deligee.flush(); 76 } 77 78 public void close() throws IOException { 79 deligee.close(); 80 } 81 82 public Device print(char c) throws IOException { 83 deligee.print(c); 84 return this; 85 } 86 87 public Device print(char[] c) throws IOException { 88 deligee.print(c); 89 return this; 90 } 91 92 public Device print(char[] c, int start, int len) throws IOException { 93 deligee.print(c, start, len); 94 return this; 95 } 96 97 public Device print(String s) throws IOException { 98 deligee.print(s); 99 return this; 100 } 101 102 public Device print(int i) throws IOException { 103 deligee.print(i); 104 return this; 105 } 106 107 public Device print(Object o) throws IOException { 108 deligee.print(o); 109 return this; 110 } 111 112 public Device write(int c) throws IOException { 113 deligee.write(c); 114 return this; 115 } 116 117 public Device write(byte b[]) throws IOException { 118 deligee.write(b); 119 return this; 120 } 121 122 public Device write(byte b[], int off, int len) throws IOException { 123 deligee.write(b, off, len); 124 return this; 125 } 126 } 127 128 129 | Popular Tags |