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
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic RiffSize.Builderbuilder()Creates a builder forRiffSize.static RiffSizecopyOf(RiffSizeType instance) Creates an immutable copy of aRiffSizeTypevalue.booleanThis instance is equal to all instances ofRiffSizethat have equal attribute values.inthashCode()Computes a hash code from attributes:size,padded.booleanisPadded()static RiffSizeof(long size, boolean padded) Construct a new immutableRiffSizeinstance.longsize()toString()Prints the immutable valueRiffSizewith attribute values.final RiffSizewithPadded(boolean value) Copy the current immutable object by setting a value for thepaddedattribute.final RiffSizewithSize(long value) Copy the current immutable object by setting a value for thesizeattribute.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.io7m.jspiel.api.RiffSizeType
checkPreconditions, sizeUnpadded
-
Method Details
-
size
public long size()- Specified by:
sizein interfaceRiffSizeType- Returns:
- The raw size value
-
isPadded
public boolean isPadded()- Specified by:
isPaddedin interfaceRiffSizeType- Returns:
trueif the size value has an extra padding byte
-
withSize
Copy the current immutable object by setting a value for thesizeattribute. 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
thisobject
-
withPadded
Copy the current immutable object by setting a value for thepaddedattribute. 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
thisobject
-
equals
This instance is equal to all instances ofRiffSizethat have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:size,padded. -
toString
Prints the immutable valueRiffSizewith attribute values. -
of
Construct a new immutableRiffSizeinstance.- Parameters:
size- The value for thesizeattributepadded- The value for thepaddedattribute- Returns:
- An immutable RiffSize instance
-
copyOf
Creates an immutable copy of aRiffSizeTypevalue. 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) // requiredsize.setPadded(boolean) // requiredpadded.build();- Returns:
- A new RiffSize builder
-