View Javadoc
1   package org.opentrafficsim.base.compressedfiles;
2   
3   /**
4    * Types of compression supported by the compressed file writers and readers.
5    * <p>
6    * Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
7    * BSD-style license. See <a href="http://opentrafficsim.org/node/13">OpenTrafficSim License</a>.
8    * <p>
9    * @version $Revision$, $LastChangedDate$, by $Author$, initial version Oct 24, 2018 <br>
10   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
11   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
12   * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a>
13   */
14  public enum CompressionType
15  {
16      /** Do not compress / uncompress the data. */
17      NONE("txt"),
18  
19      /** Create or read a ZIP archive with one, top-level entry in the TOC. */
20      ZIP("zip"),
21  
22      /** Create or read a gzip-compressed file. */
23      GZIP("gz"),
24  
25      /** Create or read a bzip2-compressed file. */
26      BZIP2("bz2"),
27  
28      /** Auto-detect the compression method (only for readers). */
29      AUTODETECT(null);
30  
31      /** Commonly used file extension for files containing data that is compressed using this method. */
32      private final String extension;
33  
34      /**
35       * Construct a CompressionType.
36       * @param extension String; commonly used file extension for files containing data that is compressed using this method
37       */
38      CompressionType(final String extension)
39      {
40          this.extension = extension;
41      }
42  
43      /**
44       * Retrieve the commonly used file extension for files containing data that is compressed using this method.
45       * @return String; the commonly used file extension for files containing data that is compressed using this method
46       */
47      public String getExtension()
48      {
49          return this.extension;
50      }
51  
52  }