public final class Bytes extends Object implements Comparable<Object>
Constructor and Description |
---|
Bytes(long bytes)
Create an immutable instance of a logical representation of a number of
bytes . |
Modifier and Type | Method and Description |
---|---|
Bytes |
add(long add)
Add a number of bytes to the current value from
getValue() and
return a new instance of Bytes . |
int |
compareTo(Object y)
If comparing to another instances of
Bytes ,
compare the values returned by getValue() . |
boolean |
equals(Object o)
If comparing to another instances of
Bytes ,
return true if the results of getValue() are the same. |
long |
getValue()
Get the underlying number of bytes as a long.
|
int |
hashCode() |
String |
toString() |
public Bytes(long bytes)
bytes
.bytes
- The number of bytes to represent.public long getValue()
public String toString()
toString
in class Object
Long.toString()
public int hashCode()
hashCode
in class Object
Long.hashCode()
public boolean equals(Object o)
Bytes
,
return true if the results of getValue()
are the same.public Bytes add(long add)
getValue()
and
return a new instance of Bytes
.add
- The amount of bytes to add.Bytes
with the
previous value summed with add
.public int compareTo(Object y)
Bytes
,
compare the values returned by getValue()
.compareTo
in interface Comparable<Object>