Example usage for jdk.nashorn.internal.objects NativeArray push

List of usage examples for jdk.nashorn.internal.objects NativeArray push

Introduction

In this page you can find the example usage for jdk.nashorn.internal.objects NativeArray push.

Prototype

@SpecializedFunction
public static double push(final Object self, final Object arg) 

Source Link

Document

ECMA 15.4.4.7 Array.prototype.push (args...) specialized for single object argument

Usage

From source file:org.siphon.common.js.JsTypeUtil.java

License:Open Source License

public ScriptObjectMirror bytesToNativeArray(byte[] arr) throws ScriptException {
    ScriptObjectMirror result = this.newArray();
    NativeArray array = result.to(NativeArray.class);
    for (int i = 0; i < arr.length; i++) {
        NativeArray.push(array, arr[i]);
        // result.callMember("push", arr[i]);
    }//www  .j a va  2s  .co m
    return result;
}