ByteArray - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.
Our website is currently undergoing maintenance, which may result in occasional errors while browsing. We apologize for any inconvenience this may cause and are working swiftly to restore full functionality. Thank you for your patience.

Online Help

All Products    Maple    MapleSim


convert/ByteArray

convert to a byte array

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

convert(expr, ByteArray)

convert(expr, ByteArray, opts)

Parameters

expr

-

Array,list,set, or string; expression to convert

opts

-

(optional) option name or equation of the form option = value where option is one of copy, format, sourceformat, or targetformat.

Options

• 

copy : truefalse

  

Indicates whether a new rtable should be allocated when converting from other rtable types such as Vector or Matrix. The default is false, meaning that convert will attempt to provide a reference to the existing rtable instead of allocating a new one.

• 

format : string

  

The option behaves identically to targetformat, but is only valid when expr is not itself a string or ByteArray.

• 

sourceformat : string

  

A string corresponding to one of the file formats described in Formats. The input expr will be decoded using the specified format and the data returned as a ByteArray.

  

If the format specified is not one for which a ByteArray is a valid output type and no target format is specified, an error is issued.

• 

targetformat : string

  

A string corresponding to one of the file formats described in Formats. The input expr will be encoded in the specified format and the encoded data returned as a ByteArray.

  

Note that this can be used in conjunction with sourceformat to decode data from a source to an arbitrary intermediate expression then encode it to ByteArray output in a different format.

Description

• 

convert(expr, ByteArray) takes a string or container object and produces a ByteArray object with content equivalent to the input.

• 

If expr is a string, it can always be converted to a ByteArray.

• 

If expr is an Array, list, or set and no source format is specified, it will be converted to a ByteArray if all the contents of expr are integers between -128 and 127.  Otherwise, an error will be issued.

Examples

Convert basic lists and strings to ByteArrays

convert1,2,3,ByteArray

123

(1)

convertHello, world,ByteArray

721011081081114432119111114108100

(2)

Convert a 3-D plot to a ByteArray encoded in the STL format

knotalgcurvesplot_knotx7+y32x5+y2,x,y,ε=0.8,radius=0.1,tubepoints=9

convertknot,ByteArray,format=STL

Compatibility

• 

The convert/ByteArray command was introduced in Maple 2015.

• 

For more information on Maple 2015 changes, see Updates in Maple 2015.

• 

The convert/ByteArray command was updated in Maple 2022.

• 

The copy, format, sourceformat and targetformat options were introduced in Maple 2022.

• 

For more information on Maple 2022 changes, see Updates in Maple 2022.

See Also

convert

convert/bytes

StringTools[ToByteArray]

type/ByteArray