log.info("auto-detected archive format: 7Z");
final SevenZFile sevenZFile = new SevenZFile(archive);
try {
SevenZArchiveEntry entry;
while( (entry = sevenZFile.getNextEntry()) != null) {
if(! entry.isDirectory()) {
log.info("loading entry {} ...", entry.getName());
// detect the file format
RDFFormat detectedFormat = Rio.getParserFormatForFileName(entry.getName());
if(format == null) {
if(detectedFormat != null) {
log.info("auto-detected entry format: {}", detectedFormat.getName());
format = detectedFormat;
} else {
throw new RDFParseException("could not detect input format of entry "+ entry.getName());
}
} else {
if(detectedFormat != null && !format.equals(detectedFormat)) {
log.warn("user-specified entry format ({}) overrides auto-detected format ({})", format.getName(), detectedFormat.getName());
} else {
log.info("user-specified entry format: {}", format.getName());
}
}
load(new InputStream() {
@Override
public int read() throws IOException {
return sevenZFile.read();
}
@Override
public int read(byte[] b) throws IOException {
return sevenZFile.read(b);
}
@Override
public int read(byte[] b, int off, int len) throws IOException {
return sevenZFile.read(b, off, len);
}
},handler,format);
}
}
} finally {
sevenZFile.close();
}
} else {
InputStream in;
String archiveCompression = detectCompression(archive);
InputStream fin = new BufferedInputStream(new FileInputStream(archive));
if(archiveCompression != null) {
if (CompressorStreamFactory.GZIP.equalsIgnoreCase(archiveCompression)) {
log.info("auto-detected archive compression: GZIP");
in = new GzipCompressorInputStream(fin,true);
} else if (CompressorStreamFactory.BZIP2.equalsIgnoreCase(archiveCompression)) {
log.info("auto-detected archive compression: BZIP2");
in = new BZip2CompressorInputStream(fin, true);
} else {
in = fin;
}
} else {
in = fin;
}
ArchiveInputStream zipStream = new ArchiveStreamFactory().createArchiveInputStream(new BufferedInputStream(in));
logArchiveType(zipStream);
ArchiveEntry entry;
while( (entry = zipStream.getNextEntry()) != null) {
if(! entry.isDirectory()) {
log.info("loading entry {} ...", entry.getName());
// detect the file format
RDFFormat detectedFormat = Rio.getParserFormatForFileName(entry.getName());
if(format == null) {
if(detectedFormat != null) {
log.info("auto-detected entry format: {}", detectedFormat.getName());
format = detectedFormat;
} else {
throw new RDFParseException("could not detect input format of entry "+ entry.getName());
}
} else {
if(detectedFormat != null && !format.equals(detectedFormat)) {
log.warn("user-specified entry format ({}) overrides auto-detected format ({})", format.getName(), detectedFormat.getName());
} else {