0

I have a very large volume of data and I need to upload it to github. So i decided to use splitted zip files and have the program merge them and then unzip them.

private static void mergeSplitFiles(String path) {
        System.out.println("Merging data from: " + path);

        try {
            ZipFile zip = new ZipFile(path + "/train.zip");
            zip.mergeSplitFiles(new File(ORIGINAL_DATA + ".zip"));
        } catch (ZipException e) {
            e.printStackTrace();
        }
    }

The merging seems great but then I tried decompressing like this:

private static void uncompressData(String path) {
        System.out.println("Uncompressing data from: " + path);
        new File(path).mkdir();

        try {
            ZipFile zip = new ZipFile(path + ".zip");
            zip.extractAll(path);

        } catch (ZipException e) {
            e.printStackTrace();
        }
    }

This code worked for manually compressed data, but fails with merged one.

Tried to manually uncompress the merged file and it crashes giving me an error halfway. I'm using the latest version in maven:

        <dependency>
            <groupId>net.lingala.zip4j</groupId>
            <artifactId>zip4j</artifactId>
            <version>2.6.1</version>
        </dependency>

The error im getting is this:

net.lingala.zip4j.exception.ZipException: Could not read corresponding local file header for file header: 2964082/61083998.txt

Cant find anything

LordHans
  • 7
  • 2

1 Answers1

0

Apparently it worked when the splitted files were made using the library. Files made with 7zip or WinRar didnt work. Had to revamp the program to also made the splitted zips from the original logs, while the orignal logs not being able to be uploaded to Github, so had to account into that.

Havent found a solution for manually (or other library) generated splitted zips files

LordHans
  • 7
  • 2