All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.skife.config.DataAmountUnit Maven / Gradle / Ivy

Go to download

Full deployment of default TransiStore service, using basic storage types, packaged as "fat jar" with its dependencies.

There is a newer version: 0.9.8
Show newest version
package org.skife.config;

public enum DataAmountUnit
{
    KIBIBYTE("KiB", 1024l),
    MEBIBYTE("MiB", 1024l*1024l),
    GIBIBYTE("GiB", 1024l*1024l*1024l),
    TEBIBYTE("TiB", 1024l*1024l*1024l*1024l),
    PEBIBYTE("PiB", 1024l*1024l*1024l*1024l*1024l),
    EXIBYTE("EiB", 1024l*1024l*1024l*1024l*1024l*1024l),

    KILOBYTE("kB", 1000l),
    MEGABYTE("MB", 1000l*1000l),
    GIGABYTE("GB", 1000l*1000l*1000l),
    TERABYTE("TB", 1000l*1000l*1000l*1000l),
    PETABYTE("PB", 1000l*1000l*1000l*1000l*1000l),
    EXABYTE("EB", 1000l*1000l*1000l*1000l*1000l*1000l);

    private final String symbol;
    private final long factor;

    private DataAmountUnit(String symbol, long factor)
    {
        this.symbol = symbol;
        this.factor = factor;
    }

    public String getSymbol()
    {
        return symbol;
    }

    public long getFactor()
    {
        return factor;
    }
    
    public static DataAmountUnit fromString(String text)
    {
        for (DataAmountUnit unit : DataAmountUnit.values()) {
            if (unit.symbol.equals(text)) {
                return unit;
            }
        }
        throw new IllegalArgumentException("Unknown unit " + text);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy