JavaSetByteArray Function

Action

Convenience function derived from JavaSetString function. Sets a byte 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

JavaSetByteArray( 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)
    JavaSetByteArray(hTestObj, str, 19);

    JavaCallMethod(hTestObj, "doFoo");
    // calling Java method doFoo(char[] chars)
    JavaSetString(hTestObj, str, 19, JAVA_BYTE_ARRAY);
    JavaCallMethod(hTestObj, "doFoo");
  end TMyJavaTrans;

  transaction TEnd
  begin
    JavaFreeObject(hTestObj);
  end TEnd;