JavaSetCharArray Function

Action

Convenience function derived from JavaSetString function. Sets a character array parameter for the next function or constructor call.

Note: Parameters must exactly match the method signature and be in order.

Include file

Java.bdh

Syntax

JavaSetCharArray( in hObject : number,
                  in sParam  : string allownull,
                  in nLen    : number optional );
Parameter Description
hObject Valid handle to a java object or JAVA_STATIC_METHOD.
sParam The string to be set as parameter.
nLen The length of the string parameter (optional). Should be used if the string contains null bytes.

Example

var  hTestObj   : number; 

dcltrans
  transaction TInit
  begin
    // Load and start the JVM.
    JavaCreateJavaVM();

    // instantiate the java class
    hTestObj := JavaLoadObject("Test");
  end TInit;

  transaction TMyJavaTrans
  var
    str : string init "abc hello world äöü";
  begin
    // calling Java method doFoo(char[] chars)
    JavaSetCharArray(hTestObj, str, strlen(str));
    JavaCallMethod(hTestObj, "doFoo");
    // calling Java method doFoo(char[] chars)
    JavaSetString(hTestObj, str, 0, JAVA_CHAR_ARRAY);
    JavaCallMethod(hTestObj, "doFoo");
  end TMyJavaTrans;

   transaction TEnd  
   begin
    JavaFreeObject(hTestObj);
  end TEnd;