eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'FileURI':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: FileURI


Inheritance:

   Object
   |
   +--URI
      |
      +--HierarchicalURI
         |
         +--FileURI

Package:
stx:libbasic2
Category:
Net-Resources
Version:
rev: 1.19 date: 2016/10/28 15:34:56
user: stefan
file: FileURI.st directory: libbasic2
module: stx stc-classLibrary: libbasic2

Class protocol:

accessing
o  schemes
answer the list of supported schemes

instance creation
o  fromFilename: aFilename
create an URI based on an a filename


Instance protocol:

converting
o  asFilename
answer the receiver represented as filename

usage example(s):

        (URI fromString:'file:///dir/file') asFilename
        (URI fromString:'file:///C:dir/file') asFilename
        (URI fromString:'file:///C:/dir/file') asFilename
        (URI fromString:'file:///~/bla') asFilename
        (URI fromString:'file:///~root/bla') asFilename 
        (URI fromString:'file:////host/dir/file') asFilename 

initialization
o  fromFilename: aFilename
create an URI based on an a filename

usage example(s):

      self fromFilename:'/a/b/c'  asFilename   
      self fromFilename:'//a/b/c' asFilename  
      self fromFilename:'a/b/c'   asFilename    

      self fromFilename:'\a\b\c'  asFilename   
      self fromFilename:'~user\a\b\c'  asFilename   
      self fromFilename:'C:\a\b\c'  asFilename   
      self fromFilename:'\\a\b\c'  asFilename 
      self fromFilename:'a\b\c'   asFilename    

queries
o  exists

stream access
o  readStream
'file:/etc/group' asURI readStream contents
'file:/~/.profile' asURI readStream contents
(URI fromString:'file:~/.profile') asFilename
(URI fromString:'file:~/.profile') readStream upToEnd

o  readStreamDo: aBlock
evaluate a block with the read stream as first argument
and a dictionary containing attributes as second argument.
The stream is closed after aBlock has been evaluated.

usage example(s):

     '/etc/group' asURI readStreamDo:[:stream :attributes|
        stream contents         
                addFirst:attributes printString; 
                yourself
     ].

     'file:/etc/group' asURI readStreamDo:[:stream :attributes|
        stream contents         
                addFirst:attributes printString; 
                yourself
     ].

o  readStreamsDo: aBlock
evaluate the block with a Collection of streams as first argument
and a dictionary containing attributes as second argument,
- a collection with a stream on a single file,
- or a collection with streams on a directorie's files, but not recursive

o  readStreamsDo: aBlock filterBlock: oneArgFilterBlock renameBlock: renameBlock
evaluate the block with a Collection of streams as first argument
and a dictionary containing attributes as second argument,
- a collection with a stream on a single file,
- or a collection with streams on a directories files, but not recursive

usage example(s):

        (URI fromString:'file:~/test/out') 
            readStreamsDo:[:stream :attributes | 
                Transcript showCR:(attributes at:#baseName).
                Transcript showCR:(attributes at:#fileSize).
                Transcript showCR:(attributes at:#requestDirectory).
                Transcript showCR:(attributes at:#uriInfo).
            ].
        (URI fromString:'file:~/test/out/*1') 
            readStreamsDo:[:stream :attributes | 
                Transcript showCR:(attributes at:#baseName).
                Transcript showCR:(attributes at:#fileSize).
                Transcript showCR:(attributes at:#requestDirectory).
                Transcript showCR:(attributes at:#uriInfo).
            ].

o  writeStreamDo: aBlock
evaluate a block with the write stream as first argument
and a dictionary containing attributes as second argument.
The stream is closed after aBlock has been evaluated.
Attributes may be the mime type (key #MIME)

o  writeStreamDo: aBlock create: doCreate

o  writeStreamDo: aBlock create: doCreate atomic: doAtomic
evaluate a block with the write stream as first argument
and a dictionary containing attributes as second argument.
The stream is closed after aBlock has been evaluated.
Attributes may be the mime type (key #MIME)

If doCreate is true, a nonExistent directory will be created.
If doAtomic is true, files will appear atomically, by using
an intermediate file theat will be renamed



ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Wed, 24 Apr 2024 03:16:16 GMT