FtpURI.st
author Stefan Vogel <sv@exept.de>
Thu, 17 Jan 2002 15:25:48 +0100
changeset 1005 7ed6fa7ccfba
child 1254 baf01931b9d6
permissions -rw-r--r--
initial checkin

"{ Package: 'stx:libbasic2' }"

HierarchicalURI subclass:#FtpURI
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Resources'
!


!FtpURI class methodsFor:'accessing'!

schemes

    ^ #(ftp)
! !

!FtpURI methodsFor:'defaults'!

defaultPassword

    ^ 'secret@secret'
!

defaultPort
    "answer the default command-port here"

    ^ 21
!

defaultUser

    ^ 'anonymous'
! !

!FtpURI methodsFor:'stream access'!

readStreamDo:aBlock
    "use FTPClient for now"

    |ftp stream|

    ftp := FTPClient new.
    [
        ftp connectTo:self host 
            port:self port 
            user:(self user ? self defaultUser)
            password:(self password ? self defaultPassword).
        stream := ftp getStreamFor:self path.
        aBlock value:stream value:(Dictionary new at:#MIME put:'text/plain').
    ] ensure:[
        stream notNil ifTrue:[
            stream close.
        ].
        ftp notNil ifTrue:[
            ftp close.
        ].
    ]
    "
     'ftp://stefan:mschrat.14@hippo/etc/group' asURI readStreamDo:[:stream :attributes | 
         self halt
      ].
    "
! !

!FtpURI class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libbasic2/FtpURI.st,v 1.1 2002-01-17 14:25:12 stefan Exp $'
! !