org.eclipse.mat.query

## Class Bytes

- java.lang.Object
- - org.eclipse.mat.query.Bytes

All Implemented Interfaces:
  Comparable<Object>

    public final class Bytes
    extends Object
    implements Comparable<Object>

Logical representation of a number of bytes. This class is immutable, so operations such as add will return new instances.

Since:
  1.5

### Constructor Summary

Constructors
Constructor and Description
`Bytes(long bytes)` Create an immutable instance of a logical representation of a number of `bytes`.

### Method Summary

All Methods Instance Methods Concrete Methods
`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()`

### Methods inherited from class java.lang.Object

`getClass, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### Bytes

    public Bytes(long bytes)

Create an immutable instance of a logical representation of a number of `bytes`.

Parameters:
  `bytes` - The number of bytes to represent.

### Method Detail

#### getValue

    public long getValue()

Get the underlying number of bytes as a long.

Returns:
  The underlying number of bytes as a long.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`
See Also:
  `Long.toString()`

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `Object`
See Also:
  `Long.hashCode()`

#### equals

    public boolean equals(Object o)

If comparing to another instances of `Bytes`, return true if the results of `getValue()` are the same.

Overrides:
  `equals` in class `Object`

#### add

    public Bytes add(long add)

Add a number of bytes to the current value from `getValue()` and return a new instance of `Bytes`.

Parameters:
  `add` - The amount of bytes to add.
Returns:
  A new instance of `Bytes` with the previous value summed with `add`.

#### compareTo

    public int compareTo(Object y)

If comparing to another instances of `Bytes`, compare the values returned by `getValue()`.

Specified by:
  `compareTo` in interface `Comparable<Object>`