de.waldheinz.fs.fat
Class FatLfnDirectory

java.lang.Object
  extended by de.waldheinz.fs.AbstractFsObject
      extended by de.waldheinz.fs.fat.FatLfnDirectory
All Implemented Interfaces:
FsDirectory, FsObject, Iterable<FsDirectoryEntry>

public final class FatLfnDirectory
extends AbstractFsObject
implements FsDirectory

The FsDirectory implementation for FAT file systems. This implementation aims to fully comply to the FAT specification, including the quite complex naming system regarding the long file names (LFNs) and their corresponding 8+3 short file names. This also means that an FatLfnDirectory is case-preserving but not case-sensitive.

Since:
0.6
Author:
gbin, Matthias Treydte <waldheinz at gmail.com>

Method Summary
 FatLfnDirectoryEntry addDirectory(String name)
           Add a new (sub-)directory with a given name to this directory. According to the FAT file system specification, leading and trailing spaces in the name are ignored by this method.
 FatLfnDirectoryEntry addFile(String name)
           Add a new file with a given name to this directory. According to the FAT file system specification, leading and trailing spaces in the name are ignored by this method.
 void flush()
          Save all dirty (unsaved) data to the device.
 FatLfnDirectoryEntry getEntry(String name)
           Gets the entry with the given name. According to the FAT file system specification, leading and trailing spaces in the name are ignored by this method.
 Iterator<FsDirectoryEntry> iterator()
          Gets an iterator to iterate over the entries of this directory.
 void remove(String name)
          Remove the entry with the given name from this directory.
 String toString()
           
 
Methods inherited from class de.waldheinz.fs.AbstractFsObject
checkValid, checkWritable, invalidate, isReadOnly, isValid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface de.waldheinz.fs.FsObject
isReadOnly, isValid
 

Method Detail

addFile

public FatLfnDirectoryEntry addFile(String name)
                             throws IOException

Add a new file with a given name to this directory.

According to the FAT file system specification, leading and trailing spaces in the name are ignored by this method.

Specified by:
addFile in interface FsDirectory
Parameters:
name - the name of the file to add
Returns:
the entry pointing to the new file
Throws:
IOException - on error creating the file

addDirectory

public FatLfnDirectoryEntry addDirectory(String name)
                                  throws IOException

Add a new (sub-)directory with a given name to this directory.

According to the FAT file system specification, leading and trailing spaces in the name are ignored by this method.

Specified by:
addDirectory in interface FsDirectory
Parameters:
name - the name of the sub-directory to add
Returns:
the entry pointing to the new directory
Throws:
IOException - on error creating the directory

getEntry

public FatLfnDirectoryEntry getEntry(String name)

Gets the entry with the given name.

According to the FAT file system specification, leading and trailing spaces in the name are ignored by this method.

Specified by:
getEntry in interface FsDirectory
Parameters:
name - the name of the entry to get
Returns:
the entry, if it existed

flush

public void flush()
           throws IOException
Description copied from interface: FsDirectory
Save all dirty (unsaved) data to the device.

Specified by:
flush in interface FsDirectory
Throws:
IOException - on write error

iterator

public Iterator<FsDirectoryEntry> iterator()
Description copied from interface: FsDirectory
Gets an iterator to iterate over the entries of this directory.

Specified by:
iterator in interface FsDirectory
Specified by:
iterator in interface Iterable<FsDirectoryEntry>
Returns:
the directory iterator

remove

public void remove(String name)
            throws IOException,
                   IllegalArgumentException
Remove the entry with the given name from this directory.

Specified by:
remove in interface FsDirectory
Parameters:
name - the name of the entry to remove
Throws:
IOException - on error removing the entry
IllegalArgumentException - on an attempt to remove the dot entries

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2014. All rights reserved.