in src/main/java/org/apache/sling/jcr/contentloader/internal/readers/ZipReader.java [148:190]
public void parse(InputStream ins, ContentCreator creator)
throws IOException, RepositoryException {
File tempFile = null;
try ( ZipInputStream zis = new ZipInputStream(ins)) {
creator.createNode(null, NT_FOLDER, null);
ZipEntry entry;
int totalSizeArchive = 0;
int totalEntryArchive = 0;
tempFile = createTempFile();
do {
entry = zis.getNextEntry();
if ( entry != null ) {
totalEntryArchive ++;
if ( !entry.isDirectory() ) {
// uncompress the entry to a temp file
totalSizeArchive = copyZipEntryToTempFile(tempFile, zis, entry,
totalSizeArchive, totalEntryArchive);
// now process the entry data from the data stored in the temp file
String name = entry.getName();
int pos = name.lastIndexOf('/');
if ( pos != -1 ) {
creator.switchCurrentNode(name.substring(0, pos), NT_FOLDER);
}
try (FileInputStream fis = new FileInputStream(tempFile)) {
creator.createFileAndResourceNode(name, fis, null, entry.getTime());
}
creator.finishNode();
creator.finishNode();
if ( pos != -1 ) {
creator.finishNode();
}
}
zis.closeEntry();
}
} while ( entry != null );
creator.finishNode();
} finally {
removeTempFile(tempFile);
}
}