Sha256: 91cec72ce326cb68e09da7ce31f24893339275adbac014508b2c2ec629f8d457

Contents?: true

Size: 966 Bytes

Versions: 4

Compression:

Stored size: 966 Bytes

Contents

package org.embulk.output.s3v2.util;

public class ChunksizeComputation extends AbstractUnitComputation
{
    private ChunksizeComputation()
    {
        // Do nothing.
    }

    public static int getChunksizeBytes(String chunksize)
    {
        if (!validateValue(chunksize)) {
            throw new IllegalArgumentException("Unrecognized value of multipart_chunksize: " + chunksize);
        }

        String sizePartOfChunksize = getSize(chunksize);
        String unitPartOfChunksize = getUnit(chunksize);
        ComputeUnits e = ComputeUnits.valueOf(unitPartOfChunksize.toUpperCase());
        double chunksizeValue = (Double.valueOf(sizePartOfChunksize) * e.getUnit());
        if (chunksizeValue < 5.0 * ComputeUnits.MB.getUnit() || 2.0 * ComputeUnits.GB.getUnit() < chunksizeValue) {
            throw new IllegalArgumentException("Unrecognized range of value multipart_chunksize: " + chunksize);
        }

        return (int) chunksizeValue;
    }
}

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/ChunksizeComputation.java
embulk-output-s3v2-0.2.1 src/main/java/org/embulk/output/s3v2/util/ChunksizeComputation.java
embulk-output-s3v2-0.2.0 src/main/java/org/embulk/output/s3v2/util/ChunksizeComputation.java
embulk-output-s3v2-0.1.0 src/main/java/org/embulk/output/s3v2/util/ChunksizeComputation.java