This concept is working with FTP files.
With this concept you can get or set FTP file content.
URL format is :
ftp://<userName>:<passwd>@<hostName>/<path>
Possible options :
-
action
- if this option is append
then the specified
string will be appended to the FTP file else the FTP file conetent will be
overwrited with the specified string
-
requests
- use this option to specify how many times will
go the search in sublinks from the current path.
-
depth
- use this option to specify how deep will go the search
in sublink from the current path.
-
filter
- use this option to specify filter for your results.
-
user
- use this option to specify userName for FTP connection.
-
pwd
- use this option to specify passwd for FTP connection.
If user
and pwd
options are specified then the userName
and the passwd
will be overwrited in the URL.
Get the content of specified FTP file.
$file from "ftp://userName:passwd@hostName/dirName/fileName"
print $file/content
Get the name of specified FTP files from specified directory recursively 5 times maximum 2 depth.
$files from "ftp://userName:passwd@hostName/dirName/" options "requests"=5 ,"depth"=2
each $file in $files do [
print $file@url]
Get the name of specified FTP files from specified directory recursively 5 times maximum 2 depth
where FTP files have 'txt' extension.
$files from "ftp://userName:passwd@hostName/dirName/" options "requests"=5 ,"depth"=2, "filter"=Simplex.create("*.txt")
each $file in $files do [
print $file@url]
Methods inherited from: Concept
cloneConcept, extendsConcept, fromXML, getAllInheritedConcepts, getConceptAttribute, getConceptAttributeField, getConceptAttributeFields, getConceptAttributes, getConceptConstructors, getConceptElement, getConceptElementField, getConceptElementFields, getConceptElements, getConceptLabel, getConceptMethod, getConceptMethods, getConceptOperators, getConceptType, getErrorHandler, getInheritedConcepts, getResourceURI, hasConceptAttribute, hasConceptElement, hasConceptMethod, hasPath, isHidden, loadContent, setConceptLabel, setErrorHandler, setHidden, setShowEmpty, showEmpty, toTXT, toXML, setResourceURI |
|
Methods inherited from: URIHandler
|
Parameters: |
$url : | The url with which this FTPHandler will be created. |
|
Creates a new FTPHandler concept with the given $url.
Parameters: |
$uri : |
The uri which will be tested if it is acceptable by this handler. |
|
Returns true if the given $uri is acceptable by this handler, false
otherwise.
print FTPHandler.acceptsURI("ftp://crow:crowp@server/kit")
-- the result is --
true
Returns true.
$url = "ftp://crow:crowp@server/kit/text.txt"
$ftp = FTPHandler.create( $url )
if $ftp.acceptsURI( $url ) then [
$m typeof Map
if ( $ftp.initialize( $m ) ) then [
if ( $ftp.openConnection ) then [
print $ftp.getContent
$ftp.closeConnection
]
]
]
-- the result is --
FTPFile
contentType: text/plain url: ftp://crow:crowp@server/kit/text.txt length: 8
content
Hello!!!
Returns the content of this FTPHandler as String concept if the content type
is text or ByteArray concept otherwise.
$url = "ftp://crow:crowp@server/kit/text.txt"
$ftp = FTPHandler.create( $url )
if $ftp.acceptsURI( $url ) then [
$m typeof Map
if ( $ftp.initialize( $m ) ) then [
if ( $ftp.openConnection ) then [
print $ftp.getContent
$ftp.closeConnection
]
]
]
-- the result is --
FTPFile
contentType: text/plain url: ftp://crow:crowp@server/kit/text.txt length: 8
content
Hello!!!
Parameters: |
$options : |
Contains a filter with which the returned content will be filtered. |
|
Exceptions: |
badURLException :
(Error) | If the URL is not valid. |
Returns true if the FTPHandler was initilized successfully, false
otherwise.
$url = "ftp://crow:crowp@server/kit/text.txt"
$ftp = FTPHandler.create( $url )
if $ftp.acceptsURI( $url ) then [
$m typeof Map
if ( $ftp.initialize( $m ) ) then [
if ( $ftp.openConnection ) then [
print $ftp.getContent
$ftp.closeConnection
]
]
]
-- the result is --
FTPFile
contentType: text/plain url: ftp://crow:crowp@server/kit/text.txt length: 8
content
Hello!!!
Returns true if the connection can be establised with the remote server
from this concept's url, false otherwise.
$url = "ftp://crow:crowp@server/kit/text.txt"
$ftp = FTPHandler.create( $url )
if $ftp.acceptsURI( $url ) then [
$m typeof Map
if ( $ftp.initialize( $m ) ) then [
if ( $ftp.openConnection ) then [
print $ftp.getContent
$ftp.closeConnection
]
]
]
-- the result is --
FTPFile
contentType: text/plain url: ftp://crow:crowp@server/kit/text.txt length: 8
content
Hello!!!
Parameters: |
$value : |
The value to be set.
The $value must be a String or a ByteArray concept. |
|
Sets this FTPHandler content to the specified $value.
$url = "ftp://crow:crowp@server/kit/text.txt"
$ftp = FTPHandler.create( $url )
if $ftp.acceptsURI( $url ) then [
$m typeof Map
$m.add("action", "append")
if ( $ftp.initialize( $m ) ) then [
if ( $ftp.openConnection ) then [
$ftp.setContent("\nMan.")
print $ftp.getContent
$ftp.closeConnection
]
]
]
-- the result is --
FTPFile
contentType: text/plain url: ftp://crow:crowp@server/kit/text.txt length: 13
content
Hello!!!
Man.