diff options
author | tkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7> | 2013-04-10 19:08:24 +0000 |
---|---|---|
committer | tkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7> | 2013-04-10 19:08:24 +0000 |
commit | 845f206be9eec01d58c822449db92c9ab6a9dc14 (patch) | |
tree | 705352749c97c4d61ae38d3276d20d3359b19cd6 /pdf-over-gui/src/main/java/at/asit/pdfover/gui/Unzipper.java | |
parent | 42b326277b1c5e559a415fe83ee9ae44f0de772f (diff) | |
download | mocca-845f206be9eec01d58c822449db92c9ab6a9dc14.tar.gz mocca-845f206be9eec01d58c822449db92c9ab6a9dc14.tar.bz2 mocca-845f206be9eec01d58c822449db92c9ab6a9dc14.zip |
Move ImageConverter and Unzipper to utils package
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@153 174cde9d-5d70-4d2a-aa98-46368bc2aaf7
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/Unzipper.java')
-rw-r--r-- | pdf-over-gui/src/main/java/at/asit/pdfover/gui/Unzipper.java | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Unzipper.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Unzipper.java deleted file mode 100644 index cc500f68..00000000 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Unzipper.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2012 by A-SIT, Secure Information Technology Center Austria - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://joinup.ec.europa.eu/software/page/eupl - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - */ -package at.asit.pdfover.gui; - -// Imports -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Unzipper to extract default configuration - */ -public class Unzipper { - /** - * SLF4J Logger instance - **/ - private static final Logger log = LoggerFactory.getLogger(Unzipper.class); - - /** - * Extracts Zip File input stream to target path - * @param is - * @param targetPath - * @throws IOException - */ - public static void unzip(InputStream is, String targetPath) throws IOException { - ZipInputStream zis = new ZipInputStream(is); - ZipEntry entry; - // while there are entries I process them - while ((entry = zis.getNextEntry()) != null) { - log.debug("entry: " + entry.getName() + ", " //$NON-NLS-1$//$NON-NLS-2$ - + entry.getSize()); - // consume all the data from this entry - - if (entry.isDirectory()) { - log.debug("Extracting directory: " + entry.getName()); //$NON-NLS-1$ - - File nDir =new File(targetPath + "/" + entry.getName()); //$NON-NLS-1$ - if(!nDir.exists()) { - if(!nDir.mkdir()) { - throw new IOException("Failed to create dir: " + entry.getName()); //$NON-NLS-1$ - } - } - continue; - } - byte[] buffer = new byte[1024]; - int len; - BufferedOutputStream out = new BufferedOutputStream( - new FileOutputStream(targetPath + "/" + entry.getName())); //$NON-NLS-1$ - while ((len = zis.read(buffer)) >= 0) - out.write(buffer, 0, len); - - out.close(); - } - } -} |