1 16 17 package de.schlichtherle.util.zip; 18 19 import java.io.IOException ; 20 import java.io.OutputStream ; 21 import java.io.UnsupportedEncodingException ; 22 import java.util.Collections ; 23 import java.util.Enumeration ; 24 25 35 public class ZipOutputStream extends BasicZipOutputStream { 36 37 43 public ZipOutputStream( 44 final OutputStream out) 45 throws NullPointerException { 46 super(out); 47 } 48 49 57 public ZipOutputStream( 58 final OutputStream out, 59 final String encoding) 60 throws NullPointerException , 61 UnsupportedEncodingException { 62 super(out, encoding); 63 } 64 65 public synchronized int size() { 66 return super.size(); 67 } 68 69 76 public synchronized Enumeration entries() { 77 return new Enumeration () { 78 Enumeration e = Collections.enumeration(Collections.list( 79 ZipOutputStream.super.entries())); 80 81 public boolean hasMoreElements() { 82 return e.hasMoreElements(); 83 } 84 85 public Object nextElement() { 86 return ((ZipEntry) e.nextElement()).clone(); 87 } 88 }; 89 } 90 91 97 public synchronized ZipEntry getEntry(String name) { 98 ZipEntry ze = super.getEntry(name); 99 return ze != null ? (ZipEntry) ze.clone() : null; 100 } 101 102 public synchronized void setComment(String comment) { 103 super.setComment(comment); 104 } 105 106 public synchronized String getComment() { 107 return super.getComment(); 108 } 109 110 public synchronized void setLevel(int level) { 111 super.setLevel(level); 112 } 113 114 public synchronized int getLevel() { 115 return super.getLevel(); 116 } 117 118 public synchronized void setMethod(short method) { 119 super.setMethod(method); 120 } 121 122 public synchronized short getMethod() { 123 return super.getMethod(); 124 } 125 126 public synchronized long length() { 127 return super.length(); 128 } 129 130 public synchronized final boolean busy() { 131 return super.busy(); 132 } 133 134 public synchronized void putNextEntry(final ZipEntry ze, final boolean deflate) 135 throws IOException { 136 super.putNextEntry(ze, deflate); 137 } 138 139 public synchronized void write(byte b) 140 throws IOException { 141 super.write(b); 142 } 143 144 public synchronized void write(final byte[] b, final int off, final int len) 145 throws IOException { 146 super.write(b, off, len); 147 } 148 149 public synchronized void closeEntry() throws IOException { 150 super.closeEntry(); 151 } 152 153 public synchronized void finish() throws IOException { 154 super.finish(); 155 } 156 157 public synchronized void close() throws IOException { 158 super.close(); 159 } 160 } 161 | Popular Tags |