pdk.flow.File
functions to work with files
All functions
readCSV
It is used to parse and extract data stored in CSV format.
The system parses the CSV file without using headers, which means that the first row of the file will be interpreted and parsed into the result records array as the first element.
The parsing algorithm uses values order to map values into structure.
It's better to delete the line containing headers from the CSV file
Arguments:
file :: pdk.io.File
records :: pdk.core.Array<T>
Result:
No variable is returned. Records array contains all values from the input file.
Possible exceptions
NullPointerException - throws if the input file or the records array is
NULL
Example:
CSV:
Structure Client
:
Order of attributes is important
Result:
writeCSV
It is used for generating a new CSV file and writing data from an input array that contains properties of simple types only.
Each record from the input array will be written on its own line. Each record property will be transformed into pdk.core.String before being written.
Avoid using structures containing properties with non-simple types. This may result in unexpected outcomes.
Avoid this:
Use simple properties:
Arguments:
records :: pdk.core.Array<T>
fileName :: pdk.core.String
Result:
output :: pdk.io.File
Possible exceptions
NullPointerException - throws if the records array of fileName argument is
NULL
Example:
File content:
rename
renames file
Arguments:
file :: pdk.io.File
newName :: pdk.core.String
Result:
No variable is returned. The input file was renamed.
Possible exceptions
NullPointerException - throws if the file of newName argument is
NULL
toByteArray
Returns a byte array as a sequence of bytes that represents the contents of the File.
Arguments:
file :: pdk.io.File
Result:
output :: pdk.core.Array<pdk.core.Byte>
Possible exceptions
NullPointerException - throws if the file argument is
NULL
fromByteArray
Creates a new temporary file with the file name provided as an argument and the specified byte content.
Arguments:
fileName :: pdk.core.String
content :: pdk.core.Array<pdk.core.Byte>
Result:
output :: pdk.io.File
Possible exceptions
NullPointerException - throws if the fileName or content argument is
NULL
Last updated