de.waldheinz.fs
Class AbstractFileSystem

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

public abstract class AbstractFileSystem
extends Object
implements FileSystem

Abstract class with common things in different FileSystem implementations.

Author:
Fabien DUMINY, Matthias Treydte <waldheinz at gmail.com>

Constructor Summary
AbstractFileSystem(boolean readOnly)
          Creates a new AbstractFileSystem.
 
Method Summary
protected  void checkClosed()
          Checks if this FileSystem was already closed, and throws an exception if it was.
protected  void checkReadOnly()
          Checks if this FileSystem is read-only, and throws an exception if it is.
 void close()
          Close this file system.
 boolean isClosed()
          Returns true if this file system is closed.
 boolean isReadOnly()
          Returns if this FileSystem is in read-only mode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.waldheinz.fs.FileSystem
flush, getFreeSpace, getRoot, getTotalSpace, getUsableSpace
 

Constructor Detail

AbstractFileSystem

public AbstractFileSystem(boolean readOnly)
Creates a new AbstractFileSystem.

Parameters:
readOnly - if the file system should be read-only
Method Detail

close

public void close()
           throws IOException
Description copied from interface: FileSystem
Close this file system. After a close, all invocations of methods of this file system or objects created by this file system will throw an IllegalStateException.

Specified by:
close in interface FileSystem
Throws:
IOException - on error closing the file system

isClosed

public final boolean isClosed()
Description copied from interface: FileSystem
Returns true if this file system is closed. If the file system is closed, no more operations may be performed on it.

Specified by:
isClosed in interface FileSystem
Returns:
if this file system is closed

isReadOnly

public final boolean isReadOnly()
Description copied from interface: FileSystem
Returns if this FileSystem is in read-only mode.

Specified by:
isReadOnly in interface FileSystem
Returns:
if this FileSystem is read-only

checkClosed

protected final void checkClosed()
                          throws IllegalStateException
Checks if this FileSystem was already closed, and throws an exception if it was.

Throws:
IllegalStateException - if this FileSystem was already closed
See Also:
isClosed(), close()

checkReadOnly

protected final void checkReadOnly()
                            throws ReadOnlyException
Checks if this FileSystem is read-only, and throws an exception if it is.

Throws:
ReadOnlyException - if this FileSystem is read-only
See Also:
isReadOnly()


Copyright © 2014. All rights reserved.