}
try {
String fileName;
int fileCounter = 0;
in.pos(offset);
LShrinkArray folderData = new LShrinkArray(in.extract(0, folderCount * 16));
posAtFilenames();
LShrinkArray fileNames = new LShrinkArray(in.extract(0, fileNameLength));
for (int i = 0; i < folderCount; i++) {
BSAFolder folder = new BSAFolder();
folderData.skip(8); // Skip Hash
folder.setFileCount(folderData.extractInt(4));
folder.dataPos = folderData.extractInt(4);
posAtFolder(folder);
folder.name = in.extractString(0, in.read() - 1) + "\\";
folder.name = folder.name.toUpperCase();
in.skip(1);
folders.put(folder.name, folder);
if (SPGlobal.debugBSAimport && SPGlobal.logging()) {
SPGlobal.logSpecial(LogTypes.BSA, header, "Loaded folder: " + folder.name);
}
for (int j = 0; j < folder.fileCount; j++) {
BSAFileRef f = new BSAFileRef();
f.size = in.extractInt(8, 3); // Skip Hash
LFlags sizeFlag = new LFlags(in.extract(1));
f.flippedCompression = sizeFlag.get(6);
f.dataOffset = in.extractLong(0, 4);
fileName = fileNames.extractString();
folder.files.put(fileName.toUpperCase(), f);
if (SPGlobal.logging()) {
SPGlobal.logSpecial(LogTypes.BSA, header, " " + fileName + ", size: " + Ln.prettyPrintHex(f.size) + ", offset: " + Ln.prettyPrintHex(f.dataOffset));
fileCounter++;
}