mn8 Language Reference | Index    

FTPFile

SUMMARY: ATTRIBUTES SUMMARY  ELEMENTS SUMMARY  CONSTRUCTORS SUMMARY  NO OPERATORS  METHODS SUMMARYDETAIL: ATTRIBUTE DETAILS  ELEMENT DETAILS  CONSTRUCTOR DETAILS  NO OPERATORS  METHOD DETAILS

Description

This concept is working with FTP files. With this concept you can get or set FTP file content, can verify if the specified FTP file is a file or is a directory, and if is a directory you can read a contents of directory.

Usage

Create specified file on FTP server and set the content of this file.

        $page = FTPFile.create("ftp://userName:passwd@hostName/dirName/fileName")
        $page.setcontent("This is a test.")

Version: 0.1
Authors:Remus Pereni (http://neuro.nolimits.ro)
Location:
Inherits: Concept

Attribute List

 @contentType TYPEOF String LABEL "contentType"
 @length TYPEOF Integer LABEL "length"
 @url TYPEOF String LABEL "url"
top

Element List

 content TYPEOF String LABEL "content"
top

Constructor List

create (String $url)
top

Method List

Logicalexists
ConceptgetContent
SeriesgetLinks
LogicalisFile
LogicalsetContent (Concept $value)
top
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

Detailed Attribute Info

@contentType

Label:contentType
Type:String
Is Static:false
Is Hidden:false
Show Empty:true

A String indicating this FTPFile content type.

top

@length

Label:length
Type:Integer
Is Static:false
Is Hidden:false
Show Empty:true

An Integer indicating this FTPFile length.

top

@url

Label:url
Type:String
Is Static:false
Is Hidden:false
Show Empty:true

A String indicating this FTPFile url.

top

Detailed Element Info

content

Label:content
Type:String
Is Static:false
Is Hidden:false
Is Multi:false
Show Empty:true

A String containing this FTPFile content.

top

Detailed Constructor Info

create (String $url)
Parameters:
$url :The url with which this FTPFile will be created.
Exceptions:
unsupportedProtocolException :
(Error)
If the specified protocol not supported by FTPFile.
badURLException :
(Error)
If the URL isn't valid.
IOException :
(Error)
If the socket could not be opened.
FTPOperationException :
(Error)
If an error occured when executing FTP command.

Creates a new FTPFile concept with the given $url.

top

Detailed Method Info

exists
Returns: Logical

Returns true if this FTPFile is already exists, false otherwise.

            $file = FTPFile.create("ftp://guest:guest@hostName/mydir/test.txt")
            print $file.exists
            -- the result is --
            true
            

top
getContent
Returns: Concept
Exceptions:
FTPOperationException :
(Error)
If unable to execute FTP command.

Returns the content of this FTPFile as String concept if the content type is text or ByteArray concept otherwise.

            $file = FTPFile.create("ftp://guest:guest@hostName/mydir/test.txt")
            print $file.getContent
            -- the result is --
            This is the file content.
            

top
getLinks
Returns: Series
Exceptions:
FTPOperationException :
(Error)
If unable to execute FTP command.

Returns the directories from this FTPFile concept url.

            $file = FTPFile.create("ftp://guest:guest@hostName/mydir/")
            print $file.getLinks
            -- the result is --
            ftp://guest:guest@hostName/mydir/docs
            ftp://guest:guest@hostName/mydir/images
            ftp://guest:guest@hostName/mydir/test.txt
            

top
isFile
Returns: Logical

Returns true if this FTPFile concept's url is a file, false otherwise.

            $file = FTPFile.create("ftp://guest:guest@hostName/mydir/")
            print $file.isFile
            $file = FTPFile.create("ftp://guest:guest@hostName/mydir/test.txt")
            print $file.isFile
            -- the result is --
            false
            true
            

top
setContent (Concept $value)
Parameters:
$value : The value to be set. The $value must be a String or a ByteArray concept.
Returns: Logical
Exceptions:
unsupportedContentException :
(Error)
If $content parameter isn't a String or a ByteArray concept.
FTPOperationException :
(Warning)
If unable to set content of FTPFile.
FTPOperationException :
(Error)
If unable to execute FTP command.

Sets this FTPFile content to the specified $value.

            $file = FTPFile.create("ftp://guest:guest@hostName/mydir/test.txt")
            print $file.getContent
            $file.setContent("and this is the new content.")
            print $file.getContent
            -- the result is --
            This is the file content.
            and this is the new content.
            

top