001    package edu.nrao.sss.util;
002    
003    
004    /**
005     * An enumeration of file compression formats to be used by
006     * SourceCatalogReaders.
007     */
008    public enum FileCompressionFormat
009    {
010            UNCOMPRESSED("uncompressed"),
011            ZIP("zip (windows)"),
012            GZ("gz");
013    
014      private String displayName;
015      
016      private FileCompressionFormat(String name)
017      {
018        displayName = name;
019      }
020      
021      /**
022       * Returns a text representation of this file compression format.
023       * @return a text representation of this file compression format.
024       */
025      @Override
026      public String toString()
027      {
028        return displayName;
029      }
030      
031      /**
032       * Returns the compression format represented by {@code text}.
033       * <p>
034       * For details about the transformation, see
035       * {@link EnumerationUtility#enumFromString(Class, String)}.</p>
036       * 
037       * @param text a text representation of a file compression format.
038       * 
039       * @return the file compression format represented by {@code text}.
040       */
041      public static FileCompressionFormat fromString(String text)
042      {
043        return EnumerationUtility.getSharedInstance()
044                                 .enumFromString(FileCompressionFormat.class, text);
045      }
046    }