ArchiveInputStream ais;
try {
ArchiveStreamFactory factory = new ArchiveStreamFactory();
ais = factory.createArchiveInputStream(stream);
} catch (ArchiveException e) {
throw new TikaException("Unable to unpack document stream", e);
}
MediaType type = getMediaType(ais);
if (!type.equals(MediaType.OCTET_STREAM)) {
metadata.set(CONTENT_TYPE, type.toString());