I’m trying to create a ZipFile from a MemoryBlock that’s in turn loaded from a File. The reason I want to go via the MemoryBlock is that I’m planning to encrypt the original file.
Loading the ZipFile directly from the File works as expected, so I’m assuming that my file is OK.
I’m loading the MemoryBlock in a constructor as follows:
File dataFile(FILE_PATH); bool doesFileExist = dataFile.existsAsFile(); jassert(doesFileExist); _rawData = new MemoryBlock(dataFile.getSize()); bool didFileLoad = dataFile.loadFileAsData(*_rawData); jassert(didFileLoad);
None of the assertions fail. The only thing that seems strange is that this goes extremely fast, even though the file is about 300MB in size. So I’m already suspecting that something might be wrong.
Later on, in a separate thread, I try to create a ZipFile from this MemoryBlock and extract some data from it:
MemoryInputStream *memStream = new MemoryInputStream(*_rawData, false); _zipFile = new ZipFile(*memStream); const int numEntries = _zipFile->getNumEntries(); jassert(numEntries == 766);
Again, the assertion doesn’t fail, so it seems I really do get 766 entries in my ZipFile (running it in the debugger also seems to confirm this). Great! But… When I look closer at the ZipEntries in the debugger, it turns out that each one has the name “” and is 0 bytes in size…
I’m trying to figure out where I went wrong? Did I forget a step somewhere?