Open topic with navigation

TIBCO GridServer® 7.1.0

# Strings and Byte Arrays

All Services can use byte arrays (`byte[]`s) interchangeably with `String`s as arguments. Conversions use UTF-8 encoding. For example, if an argument is of type `String`, and the client passes in a `byte[]`, the `byte[]` is UTF-8 encoded and passed into the method as a `String`.

Because a C++ Service always returns a `string/char*`, you must convert the returned type of an invocation to a `String` or `byte[]`. The first argument to the invocation determines the type of conversion:

| • | A string first argument returns a string.

| • | An argument of `byte[]` returns a `byte[]`.

| • | If you pass no arguments to the invocation, it returns a `byte[].`

This is most relevant for a .NET, as string I/O must be ASCII. If you are returning binary data, make sure that the first argument is a `byte[]`.

A Command Service converts the output data to a `String` only if the first argument is a `String` and the `appendArgsToCommandline` option is false.

Java and .NET Services do not convert return values if they are `String`s or `byte[]`s.

In the case where a `parameterType` value is specified, GridServer converts to the specified value. For example, if `parameterType` is set as `string`, GridServer returns strings. If set to `byte[]`, GridServer converts the return value to `byte[]`. This applies to both the C++ Service and the Command Service. You can specify the `parameterType` value for DynamicLibrary and Command Services on the Service Type Registry page.

Did you find this helpful?

Yes No
Great!
Thanks for taking the time to give us some feedback.
Sorry about that

Why wasn't this helpful? (check all that apply)

Could not find what I was looking for
Instructions confusing or unclear
Instructions did not work

Want to tell us more?

Please select at least one option or provide details about the issue!!

Error occurred while submitting feedback.

Error2 occurred while submitting feedback.

TIBCO GridServer®

Copyright © 2001-2022. TIBCO Software Inc. All Rights Reserved.