Package com.io7m.jspiel.api
Class RiffSize
java.lang.Object
com.io7m.jspiel.api.RiffSize
- All Implemented Interfaces:
RiffSizeType
A (possibly padded) size value.
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic RiffSize.Builder
builder()
Creates a builder forRiffSize
.static RiffSize
copyOf
(RiffSizeType instance) Creates an immutable copy of aRiffSizeType
value.boolean
This instance is equal to all instances ofRiffSize
that have equal attribute values.int
hashCode()
Computes a hash code from attributes:size
,padded
.boolean
isPadded()
static RiffSize
of
(long size, boolean padded) Construct a new immutableRiffSize
instance.long
size()
toString()
Prints the immutable valueRiffSize
with attribute values.final RiffSize
withPadded
(boolean value) Copy the current immutable object by setting a value for thepadded
attribute.final RiffSize
withSize
(long value) Copy the current immutable object by setting a value for thesize
attribute.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.io7m.jspiel.api.RiffSizeType
checkPreconditions, sizeUnpadded
-
Method Details
-
size
public long size()- Specified by:
size
in interfaceRiffSizeType
- Returns:
- The raw size value
-
isPadded
public boolean isPadded()- Specified by:
isPadded
in interfaceRiffSizeType
- Returns:
true
if the size value has an extra padding byte
-
withSize
Copy the current immutable object by setting a value for thesize
attribute. A value equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for size- Returns:
- A modified copy of the
this
object
-
withPadded
Copy the current immutable object by setting a value for thepadded
attribute. A value equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for padded- Returns:
- A modified copy of the
this
object
-
equals
This instance is equal to all instances ofRiffSize
that have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:size
,padded
. -
toString
Prints the immutable valueRiffSize
with attribute values. -
of
Construct a new immutableRiffSize
instance.- Parameters:
size
- The value for thesize
attributepadded
- The value for thepadded
attribute- Returns:
- An immutable RiffSize instance
-
copyOf
Creates an immutable copy of aRiffSizeType
value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.- Parameters:
instance
- The instance to copy- Returns:
- A copied immutable RiffSize instance
-
builder
Creates a builder forRiffSize
.RiffSize.builder() .setSize(long) // required
size
.setPadded(boolean) // requiredpadded
.build();- Returns:
- A new RiffSize builder
-