Skip to content

FileConverter

A class that provides functions to convert PDZ files to PD3 files and retrieve device-dependent data.

Class methods

convertPDZtoPD3

Converts a list of PDZ files to PD3 files and returns the result, including file paths, error codes, and logs. If the input files are not PDZ files, the function does not perform any conversion and returns the input file paths as they are.

Declaration

fun convertPDZtoPD3(pdzFilePaths: List<String>, workPath: String): Result

Parameters

Name Type Description
pdzFilePaths List The list of paths of the PDZ files to be converted.
workPath String The working directory where the converted files will be saved.

Return Value

Parameter Description
Result The result of the file conversion, including the list of converted file paths, error codes, and logs. If the input files are not PDZ files, the function returns the input file paths without conversion.

Types

Result

A data class containing the result of the file conversion and the corresponding data report.

Properties

Name Type Description
filePaths List A list of file paths of the converted files. If the input files are not PDZ files, this list contains the original file paths.
errorCode ErrorCode An error code. For details, see ErrorCode.
logs List A list of log entries that were generated during the file conversion. For details, see Log.
errorDescription String? A string describing the error that occurred during the file conversion, if any.

ErrorCode

An enum representing the possible error codes.

enum class ErrorCode(val id: Int) {
    NoError(0 + BaseID),
    FileNotFound(1 + BaseID),
    UnexpectedFileFormat(2 + BaseID),
    IOError(3 + BaseID),
}

Description

Constant Description
NoError The operation was successful.
FileNotFound The specified file was not found or the application does not have permission to read the file.
UnexpectedFileFormat The file format is not as expected or is incorrect.
IOError An input/output error occurred during the file operation.

Constants

BaseID

A constant value used as the base ID for error codes.

const val BaseID: Int = 30200