Platforms to show: All Mac Windows Linux Cross-Platform

Back to JavaVMMBS class.

JavaVMMBS.NewBooleanArray(ref as JavaObjectMBS) as JavaBooleanArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 8.3 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates a new array object based on the given java object.

This function is a convenience function to convert a java object array reference to a java array object in Xojo. It can crash if the java object used is not the array of the requested type.

See also:

JavaVMMBS.NewBooleanArray(size as Integer) as JavaBooleanArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 4.3 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates a new array for booleans with the given size.

Returns nil on any error.

See also:

JavaVMMBS.NewBooleanArray(values() as Boolean) as JavaBooleanArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 19.2 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates new boolean array with given values.

See also:

JavaVMMBS.NewByteArray(ref as JavaObjectMBS) as JavaByteArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 8.3 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates a new array object based on the given java object.

This function is a convenience function to convert a java object array reference to a java array object in Xojo. It can crash if the java object used is not the array of the requested type.

See also:

Some examples using this method:

JavaVMMBS.NewByteArray(size as Integer) as JavaByteArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 4.3 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates a new array for bytes with the given size.

Returns nil on any error.

See also:

JavaVMMBS.NewByteArray(values() as UInt8) as JavaBooleanArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 19.2 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates new byte array with given values.

See also:

JavaVMMBS.NewCharArray(ref as JavaObjectMBS) as JavaCharArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 8.3 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates a new array object based on the given java object.

This function is a convenience function to convert a java object array reference to a java array object in Xojo. It can crash if the java object used is not the array of the requested type.

See also:

JavaVMMBS.NewCharArray(size as Integer) as JavaCharArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 4.3 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates a new array for chars (16bit) with the given size.

Returns nil on any error.

See also:

JavaVMMBS.NewCharArray(values() as UInt16) as JavaCharArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 19.2 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates new char array with given values.

See also:

JavaVMMBS.NewDirectByteBuffer(address as Integer, size as Integer) as JavaObjectMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 4.3 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates a new DirectBuffer object based on the values in address and size.

See also:

JavaVMMBS.NewDirectByteBuffer(mem as memoryblock) as JavaObjectMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 4.3 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates a new DirectBuffer object based on a memoryblock.

Keep the memoryblock until this object is destroyed.

See also:

JavaVMMBS.NewDoubleArray(ref as JavaObjectMBS) as JavaDoubleArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 8.3 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates a new array object based on the given java object.

This function is a convenience function to convert a java object array reference to a java array object in Xojo. It can crash if the java object used is not the array of the requested type.

See also:

JavaVMMBS.NewDoubleArray(size as Integer) as JavaDoubleArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 4.3 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates a new array for doubles with the given size.

Returns nil on any error.

See also:

JavaVMMBS.NewDoubleArray(values() as Double) as JavaDoubleArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 19.2 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates new double array with given values.

See also:

JavaVMMBS.NewFloatArray(ref as JavaObjectMBS) as JavaFloatArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 8.3 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates a new array object based on the given java object.

This function is a convenience function to convert a java object array reference to a java array object in Xojo. It can crash if the java object used is not the array of the requested type.

See also:

JavaVMMBS.NewFloatArray(size as Integer) as JavaFloatArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 4.3 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates a new array for singles with the given size.

Returns nil on any error.

See also:

JavaVMMBS.NewFloatArray(values() as Single) as JavaFloatArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 19.2 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates new float array with given values.

See also:

JavaVMMBS.NewIntArray(ref as JavaObjectMBS) as JavaIntArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 8.3 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates a new array object based on the given java object.

This function is a convenience function to convert a java object array reference to a java array object in Xojo. It can crash if the java object used is not the array of the requested type.

See also:

JavaVMMBS.NewIntArray(size as Integer) as JavaIntArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 4.3 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates a new array for integers with the given size.

Returns nil on any error.

See also:

JavaVMMBS.NewIntArray(values() as Int32) as JavaIntArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 19.2 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates new Int32 array with given values.

See also:

JavaVMMBS.NewLongArray(ref as JavaObjectMBS) as JavaLongArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 8.3 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates a new array object based on the given java object.

This function is a convenience function to convert a java object array reference to a java array object in Xojo. It can crash if the java object used is not the array of the requested type.

See also:

JavaVMMBS.NewLongArray(size as Integer) as JavaLongArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 4.3 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates a new array for 64 bit integers with the given size.

Returns nil on any error.

See also:

JavaVMMBS.NewLongArray(values() as Int64) as JavaLongArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 19.2 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates new Int64 array with given values.

See also:

JavaVMMBS.NewObjectArray(ref as JavaObjectMBS) as JavaObjectArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 8.3 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates a new array object based on the given java object.

This function is a convenience function to convert a java object array reference to a java array object in Xojo. It can crash if the java object used is not the array of the requested type.

See also:

Some examples using this method:

JavaVMMBS.NewObjectArray(size as Integer, TheClass as JavaClassMBS, InitialValue as JavaObjectMBS = nil) as JavaObjectArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 4.3 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Constructs a new array holding objects in class elementClass.

All elements are initially set to initialElement.
Returns nil on any error.

See also:

JavaVMMBS.NewObjectArray(values() as JavaObjectMBS) as JavaObjectArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 19.2 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates a new Java object array with given size.

See also:

JavaVMMBS.NewShortArray(ref as JavaObjectMBS) as JavaShortArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 8.3 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates a new array object based on the given java object.

This function is a convenience function to convert a java object array reference to a java array object in Xojo. It can crash if the java object used is not the array of the requested type.

See also:

JavaVMMBS.NewShortArray(size as Integer) as JavaShortArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 4.3 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates a new array for shorts with the given size.

Returns nil on any error.

See also:

JavaVMMBS.NewShortArray(values() as Int16) as JavaShortArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 19.2 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates new short array with given values.

See also:

JavaVMMBS.NewStringArray(size as integer, InitialValue as JavaStringMBS = nil) as JavaObjectArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 19.2 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates a new Java string array with given size.

See also:

JavaVMMBS.NewStringArray(values() as String) as JavaObjectArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 19.2 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates new string array with given values.

See also:

JavaVMMBS.NewStringUnicode(s as string) as JavaStringMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 4.3 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates a new string.

Preferres an Unicode encoded string.

JavaVMMBS.NewStringUTF8(s as string) as JavaStringMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 4.3 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates a new string.
Example
// init Java
Var options() as string
Var javaVm as new JavaVMMBS(JavaVMMBS.JNI_VERSION_1_4, options, true)

// Get system class
Var system As JavaClassMBS = javaVm.FindClass("java/lang/System")

If system <> Nil Then

// query method
Var transfomerGetPropertyId as JavaMethodMBS = system.GetStaticMethod("getProperty", "(Ljava/lang/String;)Ljava/lang/String;")
If transfomerGetPropertyId <> Nil Then

// make parameters
Var keyString As JavaStringMBS = javaVm.NewStringUTF8("os.version")
Var m as New MemoryBlock(8)
m.Int64Value(0)=keyString.Handle

// run it
Var r as JavaObjectMBS = system.CallStaticObjectMethod(transfomerGetPropertyId, m)

if r<>Nil then
// show result
Var s as JavaStringMBS = JavaStringMBS(r)
MsgBox s.CopyStringUTF
end if

End If
End If

Preferres an UTF8 encoded string.

Some examples using this method:

The items on this page are in the following plugins: MBS Java Plugin.


The biggest plugin in space...