001/**
002 * Copyright 2012 Emmanuel Bourg
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package net.jsign.pe;
018
019/**
020 * Portable Executable Format.
021 * 
022 * @author Emmanuel Bourg
023 * @since 1.0
024 */
025public enum PEFormat {
026    
027    PE32(0x10b, "PE32"),
028    PE32plus(0x20b, "PE32+"),
029    ROM(0x107, "ROM");
030
031    final int value;
032    final String label;
033
034    PEFormat(int value, String label) {
035        this.value = value;
036        this.label = label;
037    }
038    
039    static PEFormat valueOf(int value) {
040        for (PEFormat format : values()) {
041            if (format.value == value) {
042                return format;
043            }
044        }
045        
046        return null;
047    }
048}