## Class Ext2File

- java.lang.Object
- - Ext2File

-     public class Ext2File
      extends java.lang.Object

  This class provides a way to readBytes bytes in a Randomly Accessed File, either from a given offset or from the current file pointer
  Author:
    Petros Soutzis, 2017-19

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private java.io.RandomAccessFile` | `raf`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Ext2File(Volume vol)` Constructor of Ext2File class.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `(package private) static java.lang.String` | `getFileSystemName()`
    `(package private) byte[]` | `readBytes(long startByte, long length)` Reads at most length bytes starting at byte offset startByte from start of file.

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

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

- - ### Field Detail

    - #### raf

          private java.io.RandomAccessFile raf

  - ### Constructor Detail

    - #### Ext2File

          public Ext2File(Volume vol)

      Constructor of Ext2File class. Will readBytes the ext2fs image and return the bytes that were readBytes.
      Parameters:
        `vol` - is the Volume that the Ext2File will readBytes bytes from.

  - ### Method Detail

    - #### readBytes

          byte[] readBytes(long startByte,
                           long length)
                    throws java.io.IOException

      Reads at most length bytes starting at byte offset startByte from start of file. Byte 0 is the first byte in the file. StartByte must be such that, 0 less or equal than, startByte less than file.size or an exception should be raised.
      Parameters:
        `startByte` - the offset from which the file will start reading from
        `length` - the size that the byte-array will have
      Returns:
        the byte array that the random access file readBytes from the volume
      Throws:
        `java.io.IOException` - is thrown when an error happens during the reading of the RAF

    - #### getFileSystemName

          static java.lang.String getFileSystemName()

      Returns:
        The name (or pathname) of the disk to read (filesystem image).