Examples of TarInputStream


Examples of org.xeustechnologies.jtar.TarInputStream

        }
        throw new Exception();
    }

    public void doDecompression(String tarFile,String destFolder) {
        TarInputStream tis = null;
        try {
            tis = new TarInputStream(new BufferedInputStream(new FileInputStream(tarFile)));
            TarEntry entry;
            try {
                while ((entry = tis.getNextEntry()) != null) {
                    int count;
                    byte data[] = new byte[2048];
                   
                    FileOutputStream fos = new FileOutputStream(destFolder + "/" + entry.getName());
                    BufferedOutputStream dest = new BufferedOutputStream(fos);
                   
                    while ((count = tis.read(data)) != -1) {
                        dest.write(data, 0, count);
                    }
                   
                    dest.flush();
                    dest.close();
                }
            } catch (IOException ex) {
                logger.warn(ex.getLocalizedMessage());
            }
            try {
                tis.close();
            } catch (IOException ex) {
                logger.warn(ex.getLocalizedMessage());
            }
        } catch (FileNotFoundException ex) {
            logger.warn(ex.getLocalizedMessage());
        } finally {
            try {
                tis.close();
            } catch (IOException ex) {
                logger.warn(ex.getLocalizedMessage());
            }
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.