i
Java Files
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 operation 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 UserService(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."); }
|