Class Fat32FileSystem

  • All Implemented Interfaces:
    FileSystem

    public class Fat32FileSystem
    extends java.lang.Object
    implements FileSystem
    This class represents the FAT32 file system and is responsible for setting the FAT32 file system up and extracting the volume label and the root directory.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long getCapacity()  
      int getChunkSize()  
      long getFreeSpace()
      ATTENTION: This value can be inaccurate, depending on actual file system and certain file system specific properties.
      long getOccupiedSpace()
      ATTENTION: This value can be inaccurate, depending on actual file system and certain file system specific properties.
      UsbFile getRootDirectory()
      This method returns the root directory of the file system.
      int getType()  
      java.lang.String getVolumeLabel()
      This method returns the name of the volume which is mostly saved in the file system.
      static Fat32FileSystem read​(BlockDeviceDriver blockDevice)
      This method constructs a FAT32 file system for the given block device.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • read

        public static Fat32FileSystem read​(BlockDeviceDriver blockDevice)
                                    throws java.io.IOException
        This method constructs a FAT32 file system for the given block device. There are no further checks if the block device actually represents a valid FAT32 file system. That means it must be ensured that the device actually holds a FAT32 file system in advance!
        Parameters:
        blockDevice - The block device the FAT32 file system is located.
        Throws:
        java.io.IOException - If reading from the device fails.
      • getRootDirectory

        public UsbFile getRootDirectory()
        Description copied from interface: FileSystem
        This method returns the root directory of the file system.
        Specified by:
        getRootDirectory in interface FileSystem
        Returns:
        The root directory of the file system.
      • getVolumeLabel

        public java.lang.String getVolumeLabel()
        Description copied from interface: FileSystem
        This method returns the name of the volume which is mostly saved in the file system.

        In Windows the name of a volume is shown in the explorer before the drive letter.

        Specified by:
        getVolumeLabel in interface FileSystem
        Returns:
      • getCapacity

        public long getCapacity()
        Specified by:
        getCapacity in interface FileSystem
        Returns:
        The total "capacity" of the file system in bytes.
      • getOccupiedSpace

        public long getOccupiedSpace()
        Description copied from interface: FileSystem
        ATTENTION: This value can be inaccurate, depending on actual file system and certain file system specific properties. Use as an estimation.
        Specified by:
        getOccupiedSpace in interface FileSystem
        Returns:
        Occupied space in the file system in bytes (estimate).
      • getFreeSpace

        public long getFreeSpace()
        Description copied from interface: FileSystem
        ATTENTION: This value can be inaccurate, depending on actual file system and certain file system specific properties. Use as an estimation.
        Specified by:
        getFreeSpace in interface FileSystem
        Returns:
        Free space in the file system in bytes (estimate).
      • getChunkSize

        public int getChunkSize()
        Specified by:
        getChunkSize in interface FileSystem
        Returns:
        returns the optimal chuck size in bytes (you should read and write in multiples of that)