Sha256: f140270aea9250a1bd8e356d164251de372cd7b61da09c48e63981c8d0e25027

Contents?: true

Size: 801 Bytes

Versions: 4

Compression:

Stored size: 801 Bytes

Contents

package org.embulk.output.s3v2.util;

abstract class AbstractUnitComputation
{
    protected enum ComputeUnits
    {
        KB(Math.pow(10, 3)),
        MB(Math.pow(10, 6)),
        GB(Math.pow(10, 9)),
        TB(Math.pow(10, 12));

        private final double unit;

        private ComputeUnits(double unit)
        {
            this.unit = unit;
        }

        public double getUnit()
        {
            return unit;
        }
    }

    protected static String getSize(String value)
    {
        return value.replaceAll("[^0-9]", "");
    }

    protected static String getUnit(String value)
    {
        return value.replaceAll("[0-9]", "");
    }

    protected static boolean validateValue(String value)
    {
        return value.matches(getSize(value) + getUnit(value));
    }
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
embulk-output-s3v2-0.3.0 src/main/java/org/embulk/output/s3v2/util/AbstractUnitComputation.java
embulk-output-s3v2-0.2.1 src/main/java/org/embulk/output/s3v2/util/AbstractUnitComputation.java
embulk-output-s3v2-0.2.0 src/main/java/org/embulk/output/s3v2/util/AbstractUnitComputation.java
embulk-output-s3v2-0.1.0 src/main/java/org/embulk/output/s3v2/util/AbstractUnitComputation.java