## Class Superblock

- java.lang.Object
- - Superblock

-     public class Superblock
      extends java.lang.Object

  This class reads the data of an ext2 filesystem's SuperBlock
  Author:
    Petros Soutzis, 2017-19

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private int` | `blockCount`
    `private int` | `blocksPerGroup`
    `private java.nio.ByteBuffer` | `buffer`
    `private int` | `inodeCount`
    `private int` | `inodesPerGroup`
    `private int` | `sInodeSize`
    `private short` | `sMagic`
    `private java.lang.String` | `volumeName`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Superblock(byte[] bytes)` Constructor of the Superblock class

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `(package private) int` | `getBlockCount()`
    `(package private) int` | `getBlockGroupCount(int num_of_blocks, int blocks_per_group)`
    `(package private) int` | `getBlocksPerGroup()`
    `(package private) int` | `getInodeCount()`
    `(package private) int` | `getInodeSize()`
    `(package private) int` | `getInodesPerGroup()`
    `(package private) java.lang.String` | `getVolumeName()`
    `(package private) void` | `printGenericData(int inodeSize, int blockGroupCount)`
    `private void` | `read()` This method will readBytes all the data that is contained in the Superblock, from the buffer in which the byte array was parsed

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### sMagic

          private short sMagic

    - #### inodeCount

          private int inodeCount

    - #### blockCount

          private int blockCount

    - #### blocksPerGroup

          private int blocksPerGroup

    - #### inodesPerGroup

          private int inodesPerGroup

    - #### sInodeSize

          private int sInodeSize

    - #### volumeName

          private java.lang.String volumeName

    - #### buffer

          private java.nio.ByteBuffer buffer

  - ### Constructor Detail

    - #### Superblock

          public Superblock(byte[] bytes)

      Constructor of the Superblock class
      Parameters:
        `bytes` - is the byte array that contains the Superblock's data

  - ### Method Detail

    - #### read

          private void read()

      This method will readBytes all the data that is contained in the Superblock, from the buffer in which the byte array was parsed

    - #### getInodeSize

          int getInodeSize()

      Returns:
        The total size of each Inode

    - #### getInodeCount

          int getInodeCount()

      Returns:
        The total number of inodes in filesystem

    - #### getInodesPerGroup

          int getInodesPerGroup()

      Returns:
        The total number of inodes in every block group

    - #### getBlockCount

          int getBlockCount()

      Returns:
        The total number of blocks in filesystem

    - #### getBlocksPerGroup

          int getBlocksPerGroup()

      Returns:
        The total number of blocks in every block group

    - #### getVolumeName

          java.lang.String getVolumeName()

      Returns:
        The disk's name

    - #### getBlockGroupCount

          int getBlockGroupCount(int num_of_blocks,
                                 int blocks_per_group)

      Parameters:
        `num_of_blocks` - the total number of blocks in the filesystem
        `blocks_per_group` - the total number of blocks in every block group
      Returns:
        The total number of block groups that the volume has

    - #### printGenericData

          void printGenericData(int inodeSize,
                                int blockGroupCount)