TarResource tr = (TarResource) r;
return new ResourceFlags(tr.getMode(), tr.getUid(),
tr.getGid(), tr.getUserName(),
tr.getGroup());
} else if (r instanceof ZipResource) {
ZipResource zr = (ZipResource) r;
return new ResourceFlags(zr.getMode(), zr.getExtraFields(),
zr.getMethod());
} else {
CommonsCompressArchiveResource cr =
(CommonsCompressArchiveResource) r;
return new ResourceFlags(cr.getMode(), cr.getUid(),
cr.getGid());
}
} else if (r instanceof
org.apache.tools.ant.types.resources.TarResource) {
org.apache.tools.ant.types.resources.TarResource tr =
(org.apache.tools.ant.types.resources.TarResource) r;
return new ResourceFlags(tr.getMode(), tr.getUid(),
tr.getGid(), tr.getUserName(),
tr.getGroup());
} else if (r instanceof
org.apache.tools.ant.types.resources.ZipResource) {
org.apache.tools.ant.types.resources.ZipResource zr =
(org.apache.tools.ant.types.resources.ZipResource) r;
org.apache.tools.zip.ZipExtraField[] extra = zr.getExtraFields();
ZipExtraField[] ex =
new ZipExtraField[extra == null ? 0 : extra.length];
if (extra != null && extra.length > 0) {
for (int i = 0; i < extra.length; i++) {
try {
ex[i] = ExtraFieldUtils
.createExtraField(new ZipShort(extra[i]
.getHeaderId()
.getValue()));
} catch (InstantiationException e) {
throw new BuildException(e);
} catch (IllegalAccessException e) {
throw new BuildException(e);
}
byte[] b = extra[i].getCentralDirectoryData();
ex[i].parseFromCentralDirectoryData(b, 0, b.length);
b = extra[i].getLocalFileDataData();
ex[i].parseFromLocalFileData(b, 0, b.length);
}
}
return new ResourceFlags(zr.getMode(), ex, zr.getMethod());
} else {
ArchiveResource ar = (ArchiveResource) r;
return new ResourceFlags(ar.getMode());
}
}