Java ZipOutputStream Write writeFolderEntry(ZipOutputStream zout, String relpath)

Here you can find the source of writeFolderEntry(ZipOutputStream zout, String relpath)

Description

Writes a new folder entry to the ZIP file.

License

Open Source License

Exception

Parameter Description
IOException If an I/O error occurs while writing the entry.

Declaration

public static void writeFolderEntry(ZipOutputStream zout, String relpath) throws IOException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.IOException;

import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

public class Main {
    /**/*  ww w  .j av  a  2  s  .c o  m*/
     * Writes a new folder entry to the ZIP file.
     *
     * @throws IOException If an I/O error occurs while writing the entry.
     */
    public static void writeFolderEntry(ZipOutputStream zout, String relpath) throws IOException {
        if (relpath.length() > 0 && !relpath.endsWith("/")) {
            relpath += "/";
        }

        ZipEntry entry = new ZipEntry(relpath);
        zout.putNextEntry(entry);
        zout.closeEntry();
    }
}

Related

  1. archiveFile(String relativePath, ZipOutputStream zos, File root)
  2. zip(File current, String rootPath, ZipOutputStream zipStream, byte[] buffer)
  3. zip(File[] files, String baseDir, ZipOutputStream zos)
  4. zip(final File directory, final File base, final ZipOutputStream zipOutputStream)
  5. zipAutoBase(File f, File base, ZipOutputStream out)