Android Open Source - trafficcop Size Unit






From Project

Back to project page trafficcop.

License

The source code is released under:

Apache License

If you think the Android project trafficcop listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.willowtreeapps.trafficcop;
/*from ww w. jav a 2s .  co  m*/
/**
 * A size unit with the base of bytes.
 */
public enum SizeUnit {
    BYTE(1), BYTES(1),
    KILOBYTE(1000), KILOBYTES(1000),
    MEGABYTE(1000 * 1000), MEGABYTES(1000 * 1000),
    GIGABYTE(1000 * 1000 * 1000), GIGABYTES(1000 * 1000 * 1000);

    private int scale;

    SizeUnit(int scale) {
        this.scale = scale;
    }

    /**
     * Converts the value from this unit to bytes
     *
     * @param value the size in this unit
     * @return the size in bytes
     */
    public long of(long value) {
        return value * scale;
    }
}




Java Source Code List

com.willowtreeapps.trafficcop.DataUsageAlertListener.java
com.willowtreeapps.trafficcop.DataUsageStatsProvider.java
com.willowtreeapps.trafficcop.DataUsage.java
com.willowtreeapps.trafficcop.LogDataUsageAlertListener.java
com.willowtreeapps.trafficcop.SizeUnit.java
com.willowtreeapps.trafficcop.Threshold.java
com.willowtreeapps.trafficcop.TimeUnit.java
com.willowtreeapps.trafficcop.TrafficCop.java