View Javadoc
1   /*
2    * Copyright (C) 2005-2015 Schlichtherle IT Services.
3    * All rights reserved. Use is subject to license terms.
4    */
5   package net.java.truevfs.comp.zip;
6   
7   import net.java.truecommons.shed.HashMaps;
8   import java.nio.charset.Charset;
9   import java.util.zip.Deflater;
10  import javax.annotation.concurrent.ThreadSafe;
11  
12  /**
13   * Default implementation of {@link ZipOutputStreamParameters}.
14   * 
15   * @author  Christian Schlichtherle
16   */
17  @ThreadSafe
18  class DefaultZipOutputStreamParameters
19  extends DefaultZipCharsetParameters
20  implements ZipOutputStreamParameters {
21      
22      DefaultZipOutputStreamParameters(Charset charset) {
23          super(charset);
24      }
25  
26      /**
27       * {@inheritDoc}
28       * <p>
29       * The implementation in the class {@link DefaultZipOutputStreamParameters}
30       * returns {@code Maps#OVERHEAD_SIZE}.
31       */
32      @Override
33      public int getOverheadSize() {
34          return HashMaps.OVERHEAD_SIZE;
35      }
36  
37      /**
38       * {@inheritDoc}
39       * <p>
40       * The implementation in the class {@link DefaultZipOutputStreamParameters}
41       * returns {@code ZipEntry#DEFLATED}.
42       */
43      @Override
44      public int getMethod() {
45          return ZipEntry.DEFLATED;
46      }
47  
48      /**
49       * {@inheritDoc}
50       * <p>
51       * The implementation in the class {@link DefaultZipOutputStreamParameters}
52       * returns {@code Deflater#DEFAULT_COMPRESSION}.
53       */
54      @Override
55      public int getLevel() {
56          return Deflater.DEFAULT_COMPRESSION;
57      }
58  }