Package com.io7m.smfj.format.binary2.internal

## Class SMFB2Section

- java.lang.Object
- - com.io7m.smfj.format.binary2.internal.SMFB2Section

- All Implemented Interfaces:
    `SMFB2SectionType`

      public final class SMFB2Section
      extends java.lang.Object
      implements SMFB2SectionType

  A parsed section.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static class` | `SMFB2Section.Builder` | Builds instances of type `SMFB2Section`.

  - ### Field Summary

    - ### Fields inherited from interface com.io7m.smfj.format.binary2.internal.SMFB2SectionType

      `SECTION_ALIGNMENT`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static SMFB2Section.Builder` | `builder()` | Creates a builder for `SMFB2Section`.
    `static SMFB2Section` | `copyOf​(SMFB2SectionType instance)` | Creates an immutable copy of a `SMFB2SectionType` value.
    `boolean` | `equals​(java.lang.Object another)` | This instance is equal to all instances of `SMFB2Section` that have equal attribute values.
    `int` | `hashCode()` | Computes a hash code from attributes: `id`, `sizeOfData`, `offset`, `sizeTotal`.
    `long` | `id()` |
    `static SMFB2Section` | `of​(long id, long sizeOfData, long offset)` | Construct a new immutable `SMFB2Section` instance.
    `long` | `offset()` |
    `long` | `sizeOfData()` | The size of the section data, not including the magic number or this size value.
    `long` | `sizeTotal()` |
    `java.lang.String` | `toString()` | Prints the immutable value `SMFB2Section` with attribute values.
    `SMFB2Section` | `withId​(long value)` | Copy the current immutable object by setting a value for the `id` attribute.
    `SMFB2Section` | `withOffset​(long value)` | Copy the current immutable object by setting a value for the `offset` attribute.
    `SMFB2Section` | `withSizeOfData​(long value)` | Copy the current immutable object by setting a value for the `sizeOfData` attribute.

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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface com.io7m.smfj.format.binary2.internal.SMFB2SectionType

      `checkPreconditions`

- - ### Method Detail

    - #### id

          public long id()

      Specified by:
        `id` in interface `SMFB2SectionType`
      Returns:
        The identifier of this section

    - #### sizeOfData

          public long sizeOfData()

      The size of the section data, not including the magic number or this size value.

      `sizeOfData() + 8 + 8` must be a multiple of `SMFB2SectionType.SECTION_ALIGNMENT`

      Specified by:
        `sizeOfData` in interface `SMFB2SectionType`
      Returns:
        The size of this section

    - #### offset

          public long offset()

      Specified by:
        `offset` in interface `SMFB2SectionType`
      Returns:
        The absolute offset of the start of the section

    - #### sizeTotal

          public long sizeTotal()

      Specified by:
        `sizeTotal` in interface `SMFB2SectionType`
      Returns:
        The total size of the section: The size of the data plus the header

    - #### withId

          public final SMFB2Section withId​(long value)

      Copy the current immutable object by setting a value for the `id` attribute. A value equality check is used to prevent copying of the same value by returning `this`.
      Parameters:
        `value` - A new value for id
      Returns:
        A modified copy of the `this` object

    - #### withSizeOfData

          public final SMFB2Section withSizeOfData​(long value)

      Copy the current immutable object by setting a value for the `sizeOfData` attribute. A value equality check is used to prevent copying of the same value by returning `this`.
      Parameters:
        `value` - A new value for sizeOfData
      Returns:
        A modified copy of the `this` object

    - #### withOffset

          public final SMFB2Section withOffset​(long value)

      Copy the current immutable object by setting a value for the `offset` attribute. A value equality check is used to prevent copying of the same value by returning `this`.
      Parameters:
        `value` - A new value for offset
      Returns:
        A modified copy of the `this` object

    - #### equals

          public boolean equals​(java.lang.Object another)

      This instance is equal to all instances of `SMFB2Section` that have equal attribute values.
      Overrides:
        `equals` in class `java.lang.Object`
      Returns:
        `true` if `this` is equal to `another` instance

    - #### hashCode

          public int hashCode()

      Computes a hash code from attributes: `id`, `sizeOfData`, `offset`, `sizeTotal`.
      Overrides:
        `hashCode` in class `java.lang.Object`
      Returns:
        hashCode value

    - #### toString

          public java.lang.String toString()

      Prints the immutable value `SMFB2Section` with attribute values.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        A string representation of the value

    - #### of

          public static SMFB2Section of​(long id,
                                        long sizeOfData,
                                        long offset)

      Construct a new immutable `SMFB2Section` instance.
      Parameters:
        `id` - The value for the `id` attribute
        `sizeOfData` - The value for the `sizeOfData` attribute
        `offset` - The value for the `offset` attribute
      Returns:
        An immutable SMFB2Section instance

    - #### copyOf

          public static SMFB2Section copyOf​(SMFB2SectionType instance)

      Creates an immutable copy of a `SMFB2SectionType` 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 SMFB2Section instance

    - #### builder

          public static SMFB2Section.Builder builder()

      Creates a builder for `SMFB2Section`.

           SMFB2Section.builder()
              .setId(long) // required id
              .setSizeOfData(long) // required sizeOfData
              .setOffset(long) // required offset
              .build();

      Returns:
        A new SMFB2Section builder