FileDocCategorySizeDatePackage
VerifierUtils.javaAPI DocGlassfish v2 API4323Fri May 04 22:33:24 BST 2007com.sun.enterprise.tools.verifier

VerifierUtils

public class VerifierUtils extends Object
author
dochez

Fields Summary
Constructors Summary
Methods Summary
public static voidcopyArchiveToDir(java.io.File source, java.io.File dest)

        AbstractArchive in = null;
        try {
            in =
                    (new JarArchiveFactory()).openArchive(
                            source.getAbsolutePath());
            copyArchiveToDir(in, dest);
        } finally {
            if (in != null)
                in.close();
        }
    
public static voidcopyArchiveToDir(com.sun.enterprise.deployment.deploy.shared.AbstractArchive source, java.io.File dest)

        for (Enumeration elements = source.entries();
             elements.hasMoreElements();) {
            String elementName = (String) elements.nextElement();
            InputStream is = source.getEntry(elementName);
            OutputStream fos = null;
            try {
                if (elementName.indexOf('/") != -1) {
                    String directory = elementName.substring(0,
                            elementName.lastIndexOf('/"));
                    File dir = new File(dest, directory);
                    if (!dir.exists()) {
                        dir.mkdirs();
                    }
                }
                File elementFile = new File(dest, elementName);
                fos = new BufferedOutputStream(
                        new FileOutputStream(elementFile));
                ArchivistUtils.copy(is, fos);
            } finally {
                try {
                    if(is != null)
                        is.close();
                    if(fos != null)
                        fos.close();
                } catch (Exception e) {}
            }
        }