org.sonatype.sisu.goodies.common
Class ByteSize

java.lang.Object
  extended by org.sonatype.sisu.goodies.common.ByteSize

public class ByteSize
extends Object

Representation of a byte size. Supports:

Since:
1.1

Nested Class Summary
static class ByteSize.ByteUnit
           
 
Constructor Summary
ByteSize(long value, ByteSize.ByteUnit unit)
           
 
Method Summary
 ByteSize asBytes()
           
 ByteSize asGigaBytes()
           
 ByteSize asKiloBytes()
           
 ByteSize asMegaBytes()
           
 ByteSize asTeraBytes()
           
static ByteSize bytes(long value)
           
 boolean equals(Object obj)
           
static ByteSize gigaBytes(long value)
           
 int hashCode()
           
static ByteSize kiloBytes(long value)
           
static ByteSize megaBytes(long value)
           
static ByteSize parse(String value)
           
static ByteSize size(long value, ByteSize.ByteUnit unit)
           
static ByteSize teraBytes(long value)
           
 long toBytes()
           
 int toBytesI()
           
 long toGigaBytes()
           
 int toGigaBytesI()
           
 long toKiloBytes()
           
 int toKiloBytesI()
           
 long toMegaBytes()
           
 int toMegaBytesI()
           
 String toString()
           
 long toTeraBytes()
           
 int toTeraBytesI()
           
 ByteSize.ByteUnit unit()
           
 long value()
           
 int valueI()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ByteSize

public ByteSize(long value,
                ByteSize.ByteUnit unit)
Method Detail

value

public long value()

valueI

public int valueI()
Since:
1.2

unit

public ByteSize.ByteUnit unit()

toBytes

public long toBytes()

toBytesI

public int toBytesI()
Since:
1.2

asBytes

public ByteSize asBytes()

toKiloBytes

public long toKiloBytes()

toKiloBytesI

public int toKiloBytesI()
Since:
1.2

asKiloBytes

public ByteSize asKiloBytes()

toMegaBytes

public long toMegaBytes()

toMegaBytesI

public int toMegaBytesI()
Since:
1.2

asMegaBytes

public ByteSize asMegaBytes()

toGigaBytes

public long toGigaBytes()

toGigaBytesI

public int toGigaBytesI()
Since:
1.2

asGigaBytes

public ByteSize asGigaBytes()

toTeraBytes

public long toTeraBytes()

toTeraBytesI

public int toTeraBytesI()
Since:
1.2

asTeraBytes

public ByteSize asTeraBytes()

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

size

public static ByteSize size(long value,
                            ByteSize.ByteUnit unit)

bytes

public static ByteSize bytes(long value)

kiloBytes

public static ByteSize kiloBytes(long value)

megaBytes

public static ByteSize megaBytes(long value)

gigaBytes

public static ByteSize gigaBytes(long value)

teraBytes

public static ByteSize teraBytes(long value)

parse

public static ByteSize parse(@NonNls
                             String value)


Copyright © 2008-2012 Sonatype, Inc.. All Rights Reserved.