Package com.ice.tar

Examples of com.ice.tar.TarOutputStream


            // Set the streams up.
            OutputStream outStream = new FileOutputStream(tarDestFile);
            if (gzipIt) {
                outStream = new GZIPOutputStream(outStream);
            }
            TarOutputStream tarOutStream = new TarOutputStream(outStream);

            // Step through all of the files.
            for (int i=0; i < fileHolder.selectedFileList.size(); i++){

                File selectedFile = fileHolder.selectedFileList.get(i);

                // This is set in case the manager kills the processor and
                // wants to log the file that was being processed.
                super.currentObjBeingProcessed = selectedFile;

                // Instance variable used so the "cleanUp()" method can
                // close this stream.
                this.inStream = new FileInputStream(selectedFile);
                TarEntry tarEntry = null;
                try {
                    tarEntry = new TarEntry(selectedFile, selectedFile.getName());
                } catch (InvalidHeaderException e) {
                    errEntry.setThrowable(e);
                    errEntry.setAppContext("tar()");
                    errEntry.setAppMessage("Error tar'ing: " + selectedFile);
                    logger.logError(errEntry);
                }

                tarOutStream.putNextEntry(tarEntry);
                while((bytes_read = inStream.read(buffer)) != -1) {
                    tarOutStream.write(buffer,0,bytes_read);
                }
                tarOutStream.closeEntry();
                inStream.close();

                // Restart the wait period (so if the time to send a single
                // file is too long the processor is killed).
                super.processorSyncFlag.restartWaitUntilFalse();
            }
            tarOutStream.close();

        } catch (Exception e) {
            errEntry.setThrowable(e);
            errEntry.setAppContext("tar()");
            errEntry.setAppMessage("Error tar'ing: " + tarDestFile);
View Full Code Here

TOP

Related Classes of com.ice.tar.TarOutputStream

Copyright © 2018 www.massapicom. 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.