I dette særtema ser vi på, hvordan cloud og AI bliver fundamentet for virksomhedernes digitale forretning, og hvordan de nye muligheder for automatisering og forretningsværdi kan udnyttes uden at miste overblik, sikkerhed og menneskelig kontrol.
/** * Java provides classes for compressing and uncompressing byte * streams. These are found in the java.util.zip package, and also * serve as the basis for Jar files (a Jar file is a Zip file with an * added manifest). * The following program takes multiple input files, and writes a * compressed output Zip file, with an entry representing each * input file: */
import java.io.*; import java.util.zip.*;
public class CompressZip { public static void doit( String[] filesin, String fileout ) { FileInputStream fis = null; FileOutputStream fos = null; try { fos = new FileOutputStream(fileout); ZipOutputStream zos = new ZipOutputStream(fos); for (int i = 0; i < filesin.length; i++) { fis = new FileInputStream(filesin[i]); ZipEntry ze = new ZipEntry(/*\"TEST\\\\prut.jar\"*/filesin[i]); zos.putNextEntry(ze); final int BUFSIZ = 4096; byte inbuf[] = new byte[BUFSIZ]; int n; while ((n = fis.read(inbuf)) != -1) zos.write(inbuf, 0, n); fis.close(); fis = null; } zos.close(); fos = null; } catch (IOException e) { System.err.println(e); } finally { try { if (fis != null) fis.close(); if (fos != null) fos.close(); } catch (IOException e) { } } } }
---------------------------------------------
Eksempel:
\' Array med filer der skal pakkes String[] files = {\"test1.txt\",\"test2.lkh\"}; \' Navn på zip fil der skal oprettes String zipFile = \"test.zip\"; \' Pak filerne CompressZip.doit(files, zipFile);
Kodylt ppstyle, det var ingen årsag! Ha\' en rigtig god weekend.
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.