try {
int signatureLength = IOUtils.readFully(in, signature);
in.reset();
if (ZipArchiveInputStream.matches(signature, signatureLength)) {
if (entryEncoding != null) {
return new ZipArchiveInputStream(in, entryEncoding);
} else {
return new ZipArchiveInputStream(in);
}
} else if (JarArchiveInputStream.matches(signature, signatureLength)) {
return new JarArchiveInputStream(in);
} else if (ArArchiveInputStream.matches(signature, signatureLength)) {
return new ArArchiveInputStream(in);