|
Class: FileURI
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
accessing
-
schemes
-
answer the list of supported schemes
instance creation
-
fromFilename: aFilename
-
create an URI based on an a filename
converting
-
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
-
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
-
exists
-
stream access
-
readStream
-
'file:/etc/group' asURI readStream contents
'file:/~/.profile' asURI readStream contents
(URI fromString:'file:~/.profile') asFilename
(URI fromString:'file:~/.profile') readStream upToEnd
-
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
].
|
-
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
-
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).
].
|
-
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)
-
writeStreamDo: aBlock create: doCreate
-
-
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
|