1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20 package edu.internet2.middleware.grouperInstallerExt.org.apache.commons.compress.compressors.gzip;
21
22 import java.util.zip.Deflater;
23
24 /**
25 * Parameters for the GZIP compressor.
26 *
27 * @since 1.7
28 */
29 public class GzipParameters {
30
31 private int compressionLevel = Deflater.DEFAULT_COMPRESSION;
32 private long modificationTime;
33 private String filename;
34 private String comment;
35 private int operatingSystem = 255; // Unknown OS by default
36
37 public int getCompressionLevel() {
38 return compressionLevel;
39 }
40
41 /**
42 * Sets the compression level.
43 *
44 * @param compressionLevel the compression level (between 0 and 9)
45 * @see Deflater#NO_COMPRESSION
46 * @see Deflater#BEST_SPEED
47 * @see Deflater#DEFAULT_COMPRESSION
48 * @see Deflater#BEST_COMPRESSION
49 */
50 public void setCompressionLevel(int compressionLevel) {
51 if (compressionLevel < -1 || compressionLevel > 9) {
52 throw new IllegalArgumentException("Invalid gzip compression level: " + compressionLevel);
53 }
54 this.compressionLevel = compressionLevel;
55 }
56
57 public long getModificationTime() {
58 return modificationTime;
59 }
60
61 /**
62 * Sets the modification time of the compressed file.
63 *
64 * @param modificationTime the modification time, in milliseconds
65 */
66 public void setModificationTime(long modificationTime) {
67 this.modificationTime = modificationTime;
68 }
69
70 public String getFilename() {
71 return filename;
72 }
73
74 /**
75 * Sets the name of the compressed file.
76 *
77 * @param filename the name of the file without the directory path
78 */
79 public void setFilename(String filename) {
80 this.filename = filename;
81 }
82
83 public String getComment() {
84 return comment;
85 }
86
87 public void setComment(String comment) {
88 this.comment = comment;
89 }
90
91 public int getOperatingSystem() {
92 return operatingSystem;
93 }
94
95 /**
96 * Sets the operating system on which the compression took place.
97 * The defined values are:
98 * <ul>
99 * <li>0: FAT filesystem (MS-DOS, OS/2, NT/Win32)</li>
100 * <li>1: Amiga</li>
101 * <li>2: VMS (or OpenVMS)</li>
102 * <li>3: Unix</li>
103 * <li>4: VM/CMS</li>
104 * <li>5: Atari TOS</li>
105 * <li>6: HPFS filesystem (OS/2, NT)</li>
106 * <li>7: Macintosh</li>
107 * <li>8: Z-System</li>
108 * <li>9: CP/M</li>
109 * <li>10: TOPS-20</li>
110 * <li>11: NTFS filesystem (NT)</li>
111 * <li>12: QDOS</li>
112 * <li>13: Acorn RISCOS</li>
113 * <li>255: Unknown</li>
114 * </ul>
115 *
116 * @param operatingSystem the code of the operating system
117 */
118 public void setOperatingSystem(int operatingSystem) {
119 this.operatingSystem = operatingSystem;
120 }
121 }