## Class FileInfo

- java.lang.Object
- - FileInfo

-     public class FileInfo
      extends java.lang.Object

  This class has methods for reading the contents of the disk.
  Author:
    Petros Soutzis

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `FileInfo()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `private static void` | `printBlockData(int blockNumber, int inodeSize, boolean isFile, Ext2File ext2, Superblock superblock, GroupDescriptor groupDescriptor)` This method will print the data contained in a file or the metadata from the inode, if it is a Directory
    `private static void` | `readBlockData(Inode inode, boolean isFile, int inodeSize, Ext2File ext2, Superblock superblock, GroupDescriptor groupDescriptor)` This method will readBytes the block pointers values of an inode and if a pointer points to real data, it will call the appropriate methods to print that data.
    `(package private) static void` | `readDirectoryData(Inode inode, int inodeSize, Ext2File ext2, Superblock superblock, GroupDescriptor groupDescriptor)` This method will be used to display contents of a directory
    `private static void` | `readDoubleIndirectData(int blockNumber, int inodeSize, boolean isFile, Ext2File ext2, Superblock superblock, GroupDescriptor groupDescriptor)` This method will readBytes the double indirect data block and if data exists it will call readIndirectData()
    `(package private) static void` | `readFileData(Inode inode, int inodeSize, Ext2File ext2, Superblock superblock, GroupDescriptor groupDescriptor, java.lang.String path)` This method will be used to print the contents of a file
    `(package private) void` | `readHexData(java.util.ArrayList<byte[]> raw)` This method will readBytes byte arrays from a list of byte arrays and print the content in a readable Hexadecimal format, with 26 hex characters in each line for readability
    `private static void` | `readIndirectData(int blockNumber, int inodeSize, boolean isFile, Ext2File ext2, Superblock superblock, GroupDescriptor groupDescriptor)` This method will readBytes the indirect data block and if data exists it will call printBlockData()
    `private static void` | `readTripleIndirectData(int blockNumber, int inodeSize, boolean isFile, Ext2File ext2, Superblock superblock, GroupDescriptor groupDescriptor)` This method will readBytes the triple indirect data block and if data exists it will call readDoubleIndirectData()

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

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

- - ### Constructor Detail

    - #### FileInfo

          public FileInfo()

  - ### Method Detail

    - #### readHexData

          void readHexData(java.util.ArrayList<byte[]> raw)

      This method will readBytes byte arrays from a list of byte arrays and print the content in a readable Hexadecimal format, with 26 hex characters in each line for readability
      Parameters:
        `raw` - is the ArrayList with bytes that this method will readBytes and print as hex

    - #### readDirectoryData

          static void readDirectoryData(Inode inode,
                                        int inodeSize,
                                        Ext2File ext2,
                                        Superblock superblock,
                                        GroupDescriptor groupDescriptor)
                                 throws java.io.IOException

      This method will be used to display contents of a directory
      Parameters:
        `inode` - The inode of the given path
        `inodeSize` - The size of the inode
        `ext2` - The disk
        `superblock` - The superblock
        `groupDescriptor` - The group descriptor
      Throws:
        `java.io.IOException` - If the disk can't be read

    - #### readFileData

          static void readFileData(Inode inode,
                                   int inodeSize,
                                   Ext2File ext2,
                                   Superblock superblock,
                                   GroupDescriptor groupDescriptor,
                                   java.lang.String path)
                            throws java.io.IOException

      This method will be used to print the contents of a file
      Parameters:
        `inode` - The inode of the given path
        `inodeSize` - The size of the inode
        `ext2` - The disk
        `superblock` - The superblock
        `groupDescriptor` - The group descriptor
        `path` - The path that was entered by the user
      Throws:
        `java.io.IOException` - If the disk can't be read

    - #### readBlockData

          private static void readBlockData(Inode inode,
                                            boolean isFile,
                                            int inodeSize,
                                            Ext2File ext2,
                                            Superblock superblock,
                                            GroupDescriptor groupDescriptor)
                                     throws java.io.IOException

      This method will readBytes the block pointers values of an inode and if a pointer points to real data, it will call the appropriate methods to print that data.
      Parameters:
        `inode` - is the Inode, whose block pointers will be readBytes
      Throws:
        `java.io.IOException` - e

    - #### printBlockData

          private static void printBlockData(int blockNumber,
                                             int inodeSize,
                                             boolean isFile,
                                             Ext2File ext2,
                                             Superblock superblock,
                                             GroupDescriptor groupDescriptor)
                                      throws java.io.IOException

      This method will print the data contained in a file or the metadata from the inode, if it is a Directory
      Parameters:
        `blockNumber` - is the offset of the data, obtained by the direct pointers to data in the inode.
      Throws:
        `java.io.IOException` - e

    - #### readIndirectData

          private static void readIndirectData(int blockNumber,
                                               int inodeSize,
                                               boolean isFile,
                                               Ext2File ext2,
                                               Superblock superblock,
                                               GroupDescriptor groupDescriptor)
                                        throws java.io.IOException

      This method will readBytes the indirect data block and if data exists it will call printBlockData()
      Parameters:
        `blockNumber` - is the offset of the data, obtained by the block pointers from the inode.
      Throws:
        `java.io.IOException` - e

    - #### readDoubleIndirectData

          private static void readDoubleIndirectData(int blockNumber,
                                                     int inodeSize,
                                                     boolean isFile,
                                                     Ext2File ext2,
                                                     Superblock superblock,
                                                     GroupDescriptor groupDescriptor)
                                              throws java.io.IOException

      This method will readBytes the double indirect data block and if data exists it will call readIndirectData()
      Parameters:
        `blockNumber` - is the offset of the data, obtained by the block pointers from the inode.
      Throws:
        `java.io.IOException` - e

    - #### readTripleIndirectData

          private static void readTripleIndirectData(int blockNumber,
                                                     int inodeSize,
                                                     boolean isFile,
                                                     Ext2File ext2,
                                                     Superblock superblock,
                                                     GroupDescriptor groupDescriptor)
                                              throws java.io.IOException

      This method will readBytes the triple indirect data block and if data exists it will call readDoubleIndirectData()
      Parameters:
        `blockNumber` - is the offset of the data, obtained by the block pointers from the inode.
      Throws:
        `java.io.IOException` - e