eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'AutoDeletedFilename':

Home

everywhere
www.exept.de
for:
[back]

Class: AutoDeletedFilename


Inheritance:

   Object
   |
   +--Filename
      |
      +--AutoDeletedFilename

Package:
stx:libbasic
Category:
System-Support
Version:
rev: 1.7 date: 2009/06/22 21:57:00
user: stefan
file: AutoDeletedFilename.st directory: libbasic
module: stx stc-classLibrary: libbasic

Description:


Used with temporary files - these will automatically delete themself,
when no longer referenced.
See -> Filename asAutoDeletedFilename


Class protocol:

queries
o  isAbstract


Instance protocol:

accessing
o  finalize
Transcript showCR:'AutoDeletedFilename: deleting ', self pathName.

o  setName: aString

removing
o  recursiveRemove

o  remove

o  removeDirectory

o  removeFile


Examples:


the following file will be automatically deleted after some time:


|f p|

f := Filename newTemporary.
f writeStream
    nextPutLine:'hello';
    close.
p := f pathName.
Transcript showCR:p.
f := f asAutoDeletedFilename.
self assert:(p asFilename exists).
ObjectMemory collectGarbage.
Delay waitForSeconds:2.
self assert:(p asFilename exists).
f := nil.
ObjectMemory collectGarbage.
Delay waitForSeconds:2.
self assert:(p asFilename exists not).
you can also delete it manually:


|f p|

f := Filename newTemporary.
f writeStream
    nextPutLine:'hello';
    close.
p := f pathName.
Transcript showCR:p.
f := f asAutoDeletedFilename.
self assert:(p asFilename exists).
ObjectMemory collectGarbage.
Delay waitForSeconds:2.
self assert:(p asFilename exists).
f remove.
f := nil.
ObjectMemory collectGarbage.
Delay waitForSeconds:2.
self assert:(p asFilename exists not).


ST/X 6.1.1; WebServer 1.620 at exept:8081; Wed, 23 May 2012 07:50:43 GMT