The list of methods to do ZipOutputStream Write are organized into topic(s).
void
zip(File[] files, String baseDir, ZipOutputStream zos) zip
byte buffer[] = new byte[BUFFER_SIZE];
for (File f : files) {
String name = f.getAbsolutePath();
if (name.startsWith(baseDir)) {
name = name.substring(baseDir.length());
if (name.startsWith(System.getProperty("file.separator"))) {
name = name.substring(1);
...
void
zipAutoBase(File f, File base, ZipOutputStream out) zip Auto Base
if (f.isDirectory()) {
for (File file : f.listFiles()) {
zipAutoBase(file, base, out);
} else {
String path = f.getPath().replace(base.getPath(), "");
if (path.startsWith(System.getProperty("file.separator"))) {
path = path.substring(1);
...
void
zipFile(ZipOutputStream out, File file, String dir) zip File
if (file.isDirectory()) {
out.putNextEntry(new ZipEntry(dir + "/"));
dir = dir.length() == 0 ? "" : dir + "/";
File[] files = file.listFiles();
for (int i = 0; i < files.length; i++) {
zipFile(out, files[i], dir + files[i].getName());
} else {
...
void
zipFile(ZipOutputStream out, File sourceFile) zip File
System.out.println("Adding File: " + sourceFile.getAbsolutePath());
FileInputStream fi = new FileInputStream(sourceFile);
BufferedInputStream origin = new BufferedInputStream(fi, BUFFER);
String entryName = sourceFile.getAbsolutePath().substring(sourceFile.getAbsolutePath().indexOf(':') + 2,
sourceFile.getAbsolutePath().length());
ZipEntry entry = new ZipEntry(entryName);
out.putNextEntry(entry);
int count;
...
void
zipFile(ZipOutputStream out, String stripPath, File file, char pathSeparator) Uses code fragments from Jakarta-Ant, Copyright: Apache Software Foundation.
ZipEntry ze = new ZipEntry(processPath(file.getPath(), stripPath, pathSeparator));
ze.setTime(file.lastModified());
out.putNextEntry(ze);
byte[] buffer = new byte[8 * 1024];
BufferedInputStream in = new BufferedInputStream(new FileInputStream(file), buffer.length);
try {
int count = 0;
while ((count = in.read(buffer, 0, buffer.length)) >= 0) {
...
void
zipFile(ZipOutputStream zipOut, String path, File file) zip File
if (!file.canRead()) {
System.out.println("Cannot read " + file.getCanonicalPath() + " (maybe because of permissions)");
return;
System.out.println("Compressing " + file.getName());
zipOut.putNextEntry(new ZipEntry(file.getName()));
FileInputStream fis = new FileInputStream(file);
byte[] buffer = new byte[4092];
...