File

Inclusion code:

Service Deployment
Port NameLocationProtocolInterfaces
File documentation:
File--FileInterface

List of Available Interfaces

FileInterface

Interface documentation:

Operation NameInput TypeOutput TypeFaults
convertFromBase64ToBinaryValuestringrawIOException( IOExceptionType )
getMimeTypestringstringFileNotFound( FileNotFoundType )
convertFromBinaryToBase64Valuerawstring
toAbsolutePathstringstringInvalidPathException( JavaExceptionType )
getParentPathstringstringInvalidPathException( JavaExceptionType )
listListRequestListResponseIOException( IOExceptionType )
copyDirCopyDirRequestboolFileNotFound( undefined ) IOException( undefined )
deleteDeleteRequestboolIOException( IOExceptionType )
getSizeanyint
getFileSeparatorvoidstring
renameRenameRequestvoidIOException( IOExceptionType )
readFileReadFileRequestundefinedFileNotFound( FileNotFoundType ) IOException( IOExceptionType )
existsstringbool
setMimeTypeFilestringvoidIOException( IOExceptionType )
deleteDirstringboolIOException( IOExceptionType )
getServiceDirectoryvoidstringIOException( IOExceptionType )
writeFileWriteFileRequestvoidFileNotFound( FileNotFoundType ) IOException( IOExceptionType )
mkdirstringbool
isDirectorystringboolFileNotFound( FileNotFoundType ) IOException( IOExceptionType )

Operation Description

convertFromBase64ToBinaryValue

Operation documentation: deprecated, please use base64ToRaw@Converter()() from converter.iol

Invocation template:

convertFromBase64ToBinaryValue@File( request )( response )

Request type

Type: string

string : string

Response type

Type: raw

raw : raw

Possible faults thrown

Fault IOException with type IOExceptionType

Fault-handling install template:

install ( IOException => /* error-handling code */ )
type IOExceptionType: JavaExceptionType

getMimeType

Operation documentation: it tests if the specified file or directory exists or not.

Invocation template:

getMimeType@File( request )( response )

Request type

Type: string

string : string

Response type

Type: string

string : string

Possible faults thrown

Fault FileNotFound with type FileNotFoundType

Fault-handling install template:

install ( FileNotFound => /* error-handling code */ )
type FileNotFoundType: WeakJavaExceptionType

convertFromBinaryToBase64Value

Operation documentation: deprecated, please use rawToBase64@Converter()() from converter.iol

Invocation template:

convertFromBinaryToBase64Value@File( request )( response )

Request type

Type: raw

raw : raw

Response type

Type: string

string : string

toAbsolutePath

Operation documentation: Constructs an absolute path to the target file or directory. Can be used to construct an absolute path for new files that does not exist yet. Throws a InvalidPathException fault if input is a relative path is not system recognized path.

Invocation template:

toAbsolutePath@File( request )( response )

Request type

Type: string

string : string

Response type

Type: string

string : string

Possible faults thrown

Fault InvalidPathException with type JavaExceptionType

Fault-handling install template:

install ( InvalidPathException => /* error-handling code */ )
type JavaExceptionType: string {
    .stackTrace: string
}

getParentPath

Operation documentation: Constructs the path to the parent directory. Can be used to construct paths that does not exist so long as the path uses the system's filesystem path conventions. Throws a InvalidPathException fault if input path is not a recognized system path or if the parent has no parent.

Invocation template:

getParentPath@File( request )( response )

Request type

Type: string

string : string

Response type

Type: string

string : string

Possible faults thrown

Fault InvalidPathException with type JavaExceptionType

Fault-handling install template:

install ( InvalidPathException => /* error-handling code */ )
type JavaExceptionType: string {
    .stackTrace: string
}

list

Operation documentation: The size of any basic type variable.

  • raw: buffer size

  • void: 0

  • boolean: 1

  • integer types: int 4, long 8

  • double: 8

  • string: size in the respective platform encoding, on ASCII and latin1

    equal to the string's length, on Unicode (UTF-8 etc.) >= string's length

Invocation template:

list@File( request )( response )

Request type

Type: ListRequest

type ListRequest: void {
    .regex?: string
    .dirsOnly?: bool
    .directory: string
    .recursive?: bool
    .order?: void {
        .byname?: bool
    }
    .info?: bool
}

ListRequest : void

  • regex : string
  • dirsOnly : bool
  • directory : string
  • recursive : bool
  • order : void
    • byname : bool
  • info : bool

Response type

Type: ListResponse

type ListResponse: void {
    .result*: string {
        .info?: void {
            .size: long
            .absolutePath: string
            .lastModified: long
            .isDirectory: bool
            .isHidden: bool
        }
    }
}

ListResponse : void

  • result : string
    • info : void
      • size : long
      • absolutePath : string
      • lastModified : long
      • isDirectory : bool
      • isHidden : bool

Possible faults thrown

Fault IOException with type IOExceptionType

Fault-handling install template:

install ( IOException => /* error-handling code */ )
type IOExceptionType: JavaExceptionType

copyDir

Operation documentation: it copies a source directory into a destination one

Invocation template:

copyDir@File( request )( response )

Request type

Type: CopyDirRequest

type CopyDirRequest: void {
    .from: string
    .to: string
}

CopyDirRequest : void : from: the source directory to copy to: the target directory to copy into

  • from : string
  • to : string

Response type

Type: bool

bool : bool

Possible faults thrown

Fault FileNotFound with type undefined

Fault-handling install template:

install ( FileNotFound => /* error-handling code */ )

Fault IOException with type undefined

Fault-handling install template:

install ( IOException => /* error-handling code */ )

delete

Operation documentation: it copies a source directory into a destination one

Invocation template:

delete@File( request )( response )

Request type

Type: DeleteRequest

type DeleteRequest: string {
    .isRegex?: int
}

DeleteRequest : string

  • isRegex : int

Response type

Type: bool

bool : bool

Possible faults thrown

Fault IOException with type IOExceptionType

Fault-handling install template:

install ( IOException => /* error-handling code */ )
type IOExceptionType: JavaExceptionType

getSize

Operation documentation: The size of any basic type variable.

  • raw: buffer size

  • void: 0

  • boolean: 1

  • integer types: int 4, long 8

  • double: 8

  • string: size in the respective platform encoding, on ASCII and latin1

    equal to the string's length, on Unicode (UTF-8 etc.) >= string's length

Invocation template:

getSize@File( request )( response )

Request type

Type: any

any : any

Response type

Type: int

int : int

getFileSeparator

Operation documentation: it tests if the specified file or directory exists or not.

Invocation template:

getFileSeparator@File( request )( response )

Request type

Type: void

void : void

Response type

Type: string

string : string

rename

Operation documentation: The size of any basic type variable.

  • raw: buffer size

  • void: 0

  • boolean: 1

  • integer types: int 4, long 8

  • double: 8

  • string: size in the respective platform encoding, on ASCII and latin1

    equal to the string's length, on Unicode (UTF-8 etc.) >= string's length

Invocation template:

rename@File( request )( response )

Request type

Type: RenameRequest

type RenameRequest: void {
    .filename: string
    .to: string
}

RenameRequest : void

  • filename : string
  • to : string

Response type

Type: void

void : void

Possible faults thrown

Fault IOException with type IOExceptionType

Fault-handling install template:

install ( IOException => /* error-handling code */ )
type IOExceptionType: JavaExceptionType

readFile

Operation documentation: Reads some file's content into a Jolie structure

  Supported formats (ReadFileRequest.format):
  - text (the default)
  - base64 (same as binary but afterwards base64-encoded)
  - binary
  - xml
  - xml_store (a type-annotated XML format)
  - properties (Java properties file)
  - json

  Child values: text, base64 and binary only populate the return's base value, the other formats fill in the child values as well.
  - xml, xml_store: the XML root node will costitute a return's child value, the rest is filled in recursively
  - properties: each property is represented by a child value
  - json: each attribute corresponds to a child value, the default values (attribute "$" or singular value) are saved as the base values, nested arrays get mapped with the "_" helper childs (e.g. a[i][j] -> a._[i]._[j]), the rest is filled in recursively

Invocation template:

readFile@File( request )( response )

Request type

Type: ReadFileRequest

type ReadFileRequest: void {
    .filename: string
    .format?: string {
        .skipMixedText?: bool
        .charset?: string
    }
}

ReadFileRequest : void

  • filename : string
  • format : string
    • skipMixedText : bool
    • charset : string

Response type

Type: undefined

undefined : any

Possible faults thrown

Fault FileNotFound with type FileNotFoundType

Fault-handling install template:

install ( FileNotFound => /* error-handling code */ )
type FileNotFoundType: WeakJavaExceptionType

Fault IOException with type IOExceptionType

Fault-handling install template:

install ( IOException => /* error-handling code */ )
type IOExceptionType: JavaExceptionType

exists

Operation documentation: it tests if the specified file or directory exists or not.

Invocation template:

exists@File( request )( response )

Request type

Type: string

string : string

Response type

Type: bool

bool : bool

setMimeTypeFile

Operation documentation: it tests if the specified file or directory exists or not.

Invocation template:

setMimeTypeFile@File( request )( response )

Request type

Type: string

string : string

Response type

Type: void

void : void

Possible faults thrown

Fault IOException with type IOExceptionType

Fault-handling install template:

install ( IOException => /* error-handling code */ )
type IOExceptionType: JavaExceptionType

deleteDir

Operation documentation: it deletes a directory recursively removing all its contents

Invocation template:

deleteDir@File( request )( response )

Request type

Type: string

string : string

Response type

Type: bool

bool : bool

Possible faults thrown

Fault IOException with type IOExceptionType

Fault-handling install template:

install ( IOException => /* error-handling code */ )
type IOExceptionType: JavaExceptionType

getServiceDirectory

Operation documentation: it tests if the specified file or directory exists or not.

Invocation template:

getServiceDirectory@File( request )( response )

Request type

Type: void

void : void

Response type

Type: string

string : string

Possible faults thrown

Fault IOException with type IOExceptionType

Fault-handling install template:

install ( IOException => /* error-handling code */ )
type IOExceptionType: JavaExceptionType

writeFile

Operation documentation: Writes a Jolie structure out to an external file

  Supported formats (WriteFileRequest.format):
  - text (the default if base value not of type raw)
  - binary (the default if base value of type raw)
  - xml
  - xml_store (a type-annotated XML format)
  - json


  Child values: text and binary only consider the content's (WriteFileRequest.content) base value, the other formats look at the child values as well.
  - xml, xml_store: the XML root node will costitute the content's only child value, the rest gets read out recursively
  - json: each child value corresponds to an attribute, the base values are saved as the default values (attribute "$" or singular value), the "_" helper childs disappear (e.g. a._[i]._[j] -> a[i][j]), the rest gets read out recursively

     when format is xml and a schema is defined, the resulting xml follows the schema constraints.
   Use "@NameSpace" in order to enable root element identification in the schema by specifying the namespace of the root.
   Use "@Prefix" for forcing a prefix in an element.
   Use "@ForceAttribute" for forcing an attribute in an element even if it is not defined in the corresponding schema

Invocation template:

writeFile@File( request )( response )

Request type

Type: WriteFileRequest

type WriteFileRequest: void {
    .filename: string
    .format?: string {
        .schema*: string
        .indent?: bool
        .doctype_system?: string
        .encoding?: string
    }
    .content: undefined
    .append?: int
}

WriteFileRequest : void

  • filename : string
  • format : string
    • schema : string
    • indent : bool
    • doctype_system : string
    • encoding : string
  • content : any
  • append : int

Response type

Type: void

void : void

Possible faults thrown

Fault FileNotFound with type FileNotFoundType

Fault-handling install template:

install ( FileNotFound => /* error-handling code */ )
type FileNotFoundType: WeakJavaExceptionType

Fault IOException with type IOExceptionType

Fault-handling install template:

install ( IOException => /* error-handling code */ )
type IOExceptionType: JavaExceptionType

mkdir

Operation documentation:

it creates the directory specified in the request root. Returns true if the directory has been created with success, false otherwise

Invocation template:

mkdir@File( request )( response )

Request type

Type: string

string : string

Response type

Type: bool

bool : bool

isDirectory

Operation documentation: it returns if a filename is a directory or not. False if the file does not exist.

Invocation template:

isDirectory@File( request )( response )

Request type

Type: string

string : string

Response type

Type: bool

bool : bool

Possible faults thrown

Fault FileNotFound with type FileNotFoundType

Fault-handling install template:

install ( FileNotFound => /* error-handling code */ )
type FileNotFoundType: WeakJavaExceptionType

Fault IOException with type IOExceptionType

Fault-handling install template:

install ( IOException => /* error-handling code */ )
type IOExceptionType: JavaExceptionType

Subtypes

JavaExceptionType

type JavaExceptionType: string { .stackTrace: string }

WeakJavaExceptionType

type WeakJavaExceptionType: any { .stackTrace?: string }