Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 18 package org.apache.tools.ant.types; 19 20 import org.apache.tools.ant.BuildException; 21 import org.apache.tools.ant.Project; 22 23 34 public class ZipFileSet extends ArchiveFileSet { 35 36 private String encoding = null; 37 38 39 public ZipFileSet() { 40 super(); 41 } 42 43 47 protected ZipFileSet(FileSet fileset) { 48 super(fileset); 49 } 50 51 55 protected ZipFileSet(ZipFileSet fileset) { 56 super(fileset); 57 encoding = fileset.encoding; 58 } 59 60 65 public void setEncoding(String enc) { 66 checkZipFileSetAttributesAllowed(); 67 this.encoding = enc; 68 } 69 70 75 public String getEncoding() { 76 if (isReference()) { 77 AbstractFileSet ref = getRef(getProject()); 78 if (ref instanceof ZipFileSet) { 79 return ((ZipFileSet) ref).getEncoding(); 80 } else { 81 return null; 82 } 83 } 84 return encoding; 85 } 86 87 91 protected ArchiveScanner newArchiveScanner() { 92 ZipScanner zs = new ZipScanner(); 93 zs.setEncoding(encoding); 94 return zs; 95 } 96 97 103 protected AbstractFileSet getRef(Project p) { 104 dieOnCircularReference(p); 105 Object o = getRefid().getReferencedObject(p); 106 if (o instanceof ZipFileSet) { 107 return (AbstractFileSet) o; 108 } else if (o instanceof FileSet) { 109 ZipFileSet zfs = new ZipFileSet((FileSet) o); 110 configureFileSet(zfs); 111 return zfs; 112 } else { 113 String msg = getRefid().getRefId() + " doesn\'t denote a zipfileset or a fileset"; 114 throw new BuildException(msg); 115 } 116 } 117 118 123 public Object clone() { 124 if (isReference()) { 125 return ((ZipFileSet) getRef(getProject())).clone(); 126 } else { 127 return super.clone(); 128 } 129 } 130 131 137 private void checkZipFileSetAttributesAllowed() { 138 if (getProject() == null 139 || (isReference() 140 && (getRefid().getReferencedObject( 141 getProject()) 142 instanceof ZipFileSet))) { 143 checkAttributesAllowed(); 144 } 145 } 146 147 } 148
| Popular Tags
|