集册 Java实例教程 创建邮编

创建邮编

欢马劈雪     最近更新时间:2020-01-02 10:19:05

387
创建邮编

/**
NowJava.com
**/

//package com.nowjava;

import java.io.BufferedInputStream;

import java.io.BufferedOutputStream;


import java.io.FileInputStream;


import java.io.FileOutputStream;


import java.util.zip.ZipEntry;


import java.util.zip.ZipOutputStream;


public class Main {

    private static final int BUFFER = 2048;


    public static void createZip(String[] files, String zipFile,

            String location) {

        BufferedInputStream origin = null;

        int count;// 来自 nowjava - 时代Java


        try {

            FileOutputStream dest = new FileOutputStream(zipFile);

            ZipOutputStream out = new ZipOutputStream(

                    new BufferedOutputStream(dest));


            byte data[] = new byte[BUFFER];


            for (int i = 0; i < files.length; i++) {

                FileInputStream fi = new FileInputStream(files[i]);

                origin = new BufferedInputStream(fi, BUFFER);

                ZipEntry entry = new ZipEntry(files[i].substring(files[i]

                        .lastIndexOf("/") + 1));

                out.putNextEntry(entry);
展开阅读全文