All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.schlichtherle.io.samples.Decrypt Maven / Gradle / Ivy

Go to download

TrueZIP is a Java based Virtual File System (VFS) to enable transparent, multi-threaded read/write access to archive files (ZIP, TAR etc.) as if they were directories. Archive files may be arbitrarily nested and the nesting level is only limited by heap and file system size.

The newest version!
/*
 * Copyright (C) 2007-2010 Schlichtherle IT Services
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package de.schlichtherle.io.samples;

import de.schlichtherle.io.*;
import de.schlichtherle.io.File;
import java.io.*;
import java.util.ResourceBundle;

/**
 * Decrypts the contents of the RAES file provided as the first argument
 * into the file provided as the second argument for the main method.
 * 

* Please note that you should not use this utility to decrypt an RAES * encrypted ZIP file (usually a file with a {@code ".tzp"} or * {@code ".zip.rae"} suffix) back to a plain ZIP file. * This is because RAES encrypted ZIP files use the "UTF-8" * as their character set, whereas plain ZIP files use "IBM437", * a.k.a. "CP437". * To decrypt an RAES encrypted ZIP file to a plain ZIP file, use the * {@code "cp"} command of the {@link NZip} class instead. * This class knows about the correct character set charsets for the * various flavours of ZIP compatible files. * * @author Christian Schlichtherle * @version $Id: Decrypt.java,v 1.4 2010/08/20 13:09:44 christian_schlichtherle Exp $ * @since TrueZIP 6.5 */ public class Decrypt extends CommandLineUtility { private static final String CLASS_NAME = "de.schlichtherle.io.samples.Decrypt"; private static final ResourceBundle resources = ResourceBundle.getBundle(CLASS_NAME); public Decrypt() { } public Decrypt(OutputStream out, OutputStream err, boolean autoFlush) { super(out, err, autoFlush); } /** Equivalent to {@code System.exit(new Decrypt().run(args));}. */ public static void main(final String[] args) { System.exit(new Decrypt().run(args)); } public boolean runWithException(final String[] args) throws IllegalUsageException, IOException { if (args.length != 2) throw new IllegalUsageException(); if (new File(args[1]).isEntry()) progressMonitor.start(); RaesFiles.decrypt(args[0], args[1], true); return true; } public class IllegalUsageException extends CommandLineUtility.IllegalUsageException { private IllegalUsageException() { super(resources.getString("usage")); } } // class IllegalUsageException }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy