Ballerina library
copybook

ballerinax/copybook Ballerina library
1.1.0
Classes
copybook: Converter
Isolated
This class represents a copybook converter that facilitates the conversion of ASCII data to and from JSON data.
Constructor
Initializes the converter with a schema.
init (string schemaFilePath)
- schemaFilePath string - The path of the copybook file
toBytes
Isolated Function
Converts the provided record or map
Parameters
- input record {} - The JSON value that needs to be converted as copybook data
- targetRecordName string? (default ()) - The name of the copybook record definition in the copybook. This parameter must be a string if the provided schema file contains more than one copybook record type definition
- encoding Encoding (default ASCII) - The encoding of the output bytes array. Default is ASCII
Return Type
- byte[]|Error - The converted byte array. In case of an error, a
copybook:Error
is is returned
fromBytes
Isolated Function
function fromBytes(byte[] bytes, string? targetRecordName, Encoding encoding) returns map<json>|Error
Converts the given copybook bytes to a Ballerina record.
Parameters
- bytes byte[] - Bytes array that needs to be converted to a record value
- targetRecordName string? (default ()) - The name of the copybook record definition in the copybook. This parameter must be a string if the provided schema file contains more than one copybook record type definition
- encoding Encoding (default ASCII) - The encoding of the input bytes array. Default is ASCII
Enums
copybook: Encoding
Represents the encoding types used for the input or output byte arrays.
Members
ASCII - Represents the ASCII encoding
EBCDIC - Represents the EBCDIC encoding
Errors
copybook: Error
Distinct
Represents copybook module related errors.
Import
import ballerinax/copybook;
Metadata
Released date: 9 days ago
Version: 1.1.0
License: Apache-2.0
Compatibility
Platform: java21
Ballerina version: 2201.11.0
GraalVM compatible: Yes
Pull count
Total: 72
Current verison: 0
Weekly downloads
Keywords
copybook
serdes
cobol
mainframe
Contributors
Dependencies