com.github.skjolber.unzip.UrlZipFileFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of unzip-csv Show documentation
Show all versions of unzip-csv Show documentation
Project for unzipping CSV files
package com.github.skjolber.unzip;
import java.io.IOException;
import java.net.URL;
import org.apache.commons.compress.archivers.zip.ZipFile;
public class UrlZipFileFactory implements ZipFileSource {
protected UrlByteChannelCache cache;
public UrlZipFileFactory(URL url, int chunkLength) {
this(url, chunkLength, -1);
}
public UrlZipFileFactory(URL url, int chunkLength, int concurrentConnections) {
cache = new UrlByteChannelCache(url, chunkLength, concurrentConnections);
}
public ZipFile getZipFile() throws IOException {
return new ZipFile(new UrlSeekableByteChannel(cache));
}
public int size() throws IOException {
return cache.getSize();
}
}