i
Java Files
Deyel allows the use of temporary files during the execution of advanced rules, facilitating the temporary storage and management of data. To do this, it uses the FileService service, through which it is possible to create and manage files of type "java.io.File" in a controlled manner and without requiring any additional storage configurations.
Objects of type "java.io.File" can only be managed by the FileService service class, unlike the other objects in the Deyel SDK, which use the model and service classes.
Content of the FileService Service Class
The service class name in Deyel SDK is fixed and must be used as FileService.
The service allows the following operations to be performed:
Operation |
Description |
Parameters |
---|---|---|
createTempFile(String pFileName) |
Creates a temporary file within Deyel. |
String pFileName: Name and extension of the file to create |
Example of Use
In the following example, FileService is used to create a temporary file with a .txt extension. A message is written and, in case of an error, the exception is logged.
FileService xFileService = new FileService(getApiClient()); java.io.File xTempFile = xFileService.createTempFile( pFileName "tempFile.txt");
try (java.io.FileWriter xWriter = new java.io.FileWriter(xTempFile.getPath())) { xWriter.write( str "Temporary text file created using the file service."); } catch (Exception e) { log( plog "An error occurred while writing to the temporary file."); }
|