eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'DirectoryContents':

Home

everywhere
www.exept.de
for:
[back]

Class: DirectoryContents


Inheritance:

   Object
   |
   +--DirectoryContents

Package:
stx:libbasic2
Category:
System-Support
Version:
rev: 1.56 date: 2010/02/03 15:24:01
user: cg
file: DirectoryContents.st directory: libbasic2
module: stx stc-classLibrary: libbasic2
Author:
Claus Atzkern

Description:


DirectoryContents provides a cached view onto a fileDirectory.


Notice:
    This class is not available in other ST-systems;
    Applications using it may not be portable.


Related information:

    Filename
    FileStream
    DirectoryStream
    OperatingSystem

Class protocol:

accessing
o  cachedDirectoryNamed: aFileOrString
answer the valid cached directory or nil

o  directoryNamed: aDirectory
returns the DirectoryContents for a directory named
aDirectoryName, aString, nil or Filename

cache flushing
o  flushCache
flush list of remembered directory contents

o  flushCachedDirectoryFor: aDirectoryOrString
remove directory from cache

o  lowSpaceCleanup
flush list of remembered directory contents when low on memory

o  preSnapshot
flush list of cached directory contents before saving a snapshot

constants
o  maxCachedDirectories
returns number of maximum cached directories

initialization
o  initialize
setup lock-mechanism

instance creation
o  new

private
o  accessKeyForDirectory: aDirectoryOrString
computes a fast access key to retrieve the directory in the cache

o  directoryAt: aFileOrString
checks whether directory already exists and is valid.
If true the directory is returned otherwise nil

o  directoryAt: aFileOrString checkForValidContentsDo: checkIsValidBlock
answer the directoryContents stored under aFileOrString in the cache.
If the evaluation of the checkIsValidBlock returns false, the contents
will be removed from the cache and nil is returned.

queries
o  directoryNamed: aDirectoryName detect: aTwoArgBlock
evaluate the block, [:filename :isDirectory] on the directory
contents of a directory named aDirectoryName, until the block
returns true. If nothing detected false is returned

o  directoryNamed: aDirectoryName detect: aTwoArgBlock onOpenErrorDo: exceptionBlock
evaluate the block, [:filename :isDirectory] on the directory
contents of a directory named aDirectoryName, until the block
returns true. If nothing detected false is returned.

if the directory cannot be open, the exceptionBlock is processed
with the filename.

utilities
o  contentsItemForFileName: aFilenameOrString


Instance protocol:

accessing
o  accessKey

o  beObsolete
mark self as obsolete
clear contents and reset time

o  directory
returns the directoy name as Filename

o  modificationTime
get the last modification time of the directory

o  timeStamp
get the last timeStamp (when the directory info was read) of the directory

enumerating
o  contentsAndBaseNamesDo: aThreeArgBlock
evaluate the block on each file; the argument to the block is the
filename, the baseName and true in case of a directory
block arguments: [:fileName :aBaseName :isDirectory|

o  contentsDo: aTwoArgBlock
evaluate the block on each file; the argument to the block is the
filename and true in case of a directory
block arguments: [:fileName :isDirectory|

o  directoriesAndBasenamesDo: aTwoArgBlock
evaluate block on each directory; a Filename and Basename.
The directories are sorted

o  directoriesDo: aOneArgBlock
evaluate block on each directory; a Filename. The directories are sorted

o  filesAndBasenamesDo: aTwoArgBlock
evaluate block on each file; a Filename and a Basename.
The files are sorted.

o  filesDo: aOneArgBlock
evaluate block on each file; a Filename. The files are sorted.

o  itemsDo: aBlock
evaluate the block on each contentsItem, which contains the fileName and type info

instance creation
o  directory: aFilename
instance creation; setup attributes

obsolete
o  updateContents

printing
o  printOn: aStream

queries
o  isObsolete
returns true if the directory contents represented by the receiver is obsolete
(i.e. if the fileSystems directory has been changed in the meanwhile)

o  isReadable
answer true if the directory is readable
no open error raised during reading the directory

o  isRootDirectory

o  size
get number of files including directories in the directory

testing
o  includesIdentical: anItem

o  isEmpty
returns true if directory is empty

o  isEmptyOrNil
returns true if directory is empty

o  notEmpty
returns true if directory is not empty

o  notEmptyOrNil
returns true if directory is not empty


Private classes:

    DirectoryContentsItem


ST/X 6.1.1; WebServer 1.620 at exept:8081; Mon, 21 May 2012 16:08:13 GMT