001/*-------------------------------------------------------------------------+
002|                                                                          |
003| Copyright (c) 2005-2019 The ConQAT Project                               |
004|                                                                          |
005| Licensed under the Apache License, Version 2.0 (the "License");          |
006| you may not use this file except in compliance with the License.         |
007| You may obtain a copy of the License at                                  |
008|                                                                          |
009|    http://www.apache.org/licenses/LICENSE-2.0                            |
010|                                                                          |
011| Unless required by applicable law or agreed to in writing, software      |
012| distributed under the License is distributed on an "AS IS" BASIS,        |
013| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
014| See the License for the specific language governing permissions and      |
015| limitations under the License.                                           |
016|                                                                          |
017+-------------------------------------------------------------------------*/
018package org.conqat.lib.commons.filesystem;
019
020import java.io.File;
021import java.io.IOException;
022import java.nio.charset.Charset;
023
024/** Wrapper around Apache Compress ZIP file that exposes the filename */
025public class ZipFile extends org.apache.commons.compress.archivers.zip.ZipFile {
026
027        /** The filename */
028        private String name;
029
030        public ZipFile(File f) throws IOException {
031                super(f);
032                this.name = f.getName();
033        }
034
035        public ZipFile(String name) throws IOException {
036                super(name);
037                this.name = name;
038        }
039
040        public ZipFile(String name, String encoding) throws IOException {
041                super(name, encoding);
042                this.name = name;
043        }
044
045        public ZipFile(File f, String encoding) throws IOException {
046                super(f, encoding);
047                this.name = f.getName();
048        }
049
050        public ZipFile(File f, String encoding, boolean useUnicodeExtraFields) throws IOException {
051                super(f, encoding, useUnicodeExtraFields);
052                this.name = f.getName();
053        }
054
055        public ZipFile(File f, Charset charset) throws IOException {
056                this(f, charset.toString());
057        }
058
059        public String getName() {
060                return name;
061        }
062}