de.waldheinz.fs.fat
Class FatFileSystem

java.lang.Object
  extended by de.waldheinz.fs.AbstractFileSystem
      extended by de.waldheinz.fs.fat.FatFileSystem
All Implemented Interfaces:
FileSystem

public final class FatFileSystem
extends AbstractFileSystem

Implements the FileSystem interface for the FAT family of file systems. This class always uses the "long file name" specification when writing directory entries.

For creating (aka "formatting") FAT file systems please refer to the SuperFloppyFormatter class.

Author:
Ewout Prangsma <epr at jnode.org>, Matthias Treydte <waldheinz at gmail.com>

Method Summary
 void flush()
          Flush all changed structures to the device.
 FatType getFatType()
          Returns the size of the FAT entries of this FatFileSystem.
 long getFreeSpace()
           The free space of this file system. This method is currently not implemented for FatFileSystem and always returns -1.
 FatLfnDirectory getRoot()
          Gets the root entry of this filesystem.
 long getTotalSpace()
           The total size of this file system. This method is currently not implemented for FatFileSystem and always returns -1.
 long getUsableSpace()
           The usable space of this file system. This method is currently not implemented for FatFileSystem and always returns -1.
 String getVolumeLabel()
          Returns the volume label of this file system.
static FatFileSystem read(BlockDevice device, boolean readOnly)
          Reads the file system structure from the specified BlockDevice and returns a fresh FatFileSystem instance to read or modify it.
 void setVolumeLabel(String label)
          Sets the volume label for this file system.
 
Methods inherited from class de.waldheinz.fs.AbstractFileSystem
checkClosed, checkReadOnly, close, isClosed, isReadOnly
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

read

public static FatFileSystem read(BlockDevice device,
                                 boolean readOnly)
                          throws IOException
Reads the file system structure from the specified BlockDevice and returns a fresh FatFileSystem instance to read or modify it.

Parameters:
device - the BlockDevice holding the file system
readOnly - if the FatFileSystem should be in read-only mode
Returns:
the FatFileSystem instance for the device
Throws:
IOException - on read error or if the file system structure could not be parsed

getFatType

public FatType getFatType()
Returns the size of the FAT entries of this FatFileSystem.

Returns:
the exact type of the FAT used by this file system

getVolumeLabel

public String getVolumeLabel()
Returns the volume label of this file system.

Returns:
the volume label

setVolumeLabel

public void setVolumeLabel(String label)
                    throws ReadOnlyException,
                           IOException
Sets the volume label for this file system.

Parameters:
label - the new volume label, may be null
Throws:
ReadOnlyException - if the file system is read-only
IOException - on write error

flush

public void flush()
           throws IOException
Flush all changed structures to the device.

Throws:
IOException - on write error

getRoot

public FatLfnDirectory getRoot()
Description copied from interface: FileSystem
Gets the root entry of this filesystem. This is usually a directory, but this is not required.

Returns:
the file system's root entry

getFreeSpace

public long getFreeSpace()

The free space of this file system.

This method is currently not implemented for FatFileSystem and always returns -1.

Returns:
always -1

getTotalSpace

public long getTotalSpace()

The total size of this file system.

This method is currently not implemented for FatFileSystem and always returns -1.

Returns:
always -1

getUsableSpace

public long getUsableSpace()

The usable space of this file system.

This method is currently not implemented for FatFileSystem and always returns -1.

Returns:
always -1


Copyright © 2014. All rights reserved.