extract Jar Entry - Java File Path IO

Java examples for File Path IO:Jar File

Description

extract Jar Entry

Demo Code

//Licensed under the Apache License, Version 2.0 (the "License");
//package com.java2s;
import java.io.File;

import java.io.IOException;

import java.util.jar.JarEntry;
import java.util.jar.JarInputStream;

public class Main {
    private static void extractEntry(File entryFile, JarInputStream jis,
            JarEntry entry, boolean deleteOnExit) throws IOException {
        File parent = new File(entryFile.getParent());
        if (!parent.exists())
            parent.mkdirs();// w  w  w. ja  va  2s  . c  o  m
        //ResourceUtil.copy(jis, new FileOutputStream(entryFile));     
        entryFile.setLastModified(entry.getTime());
        if (deleteOnExit) {
            parent.deleteOnExit();
            entryFile.deleteOnExit();
        }
    }
}

Related Tutorials