public class V8 extends V8Object
| Modifier | Constructor and Description |
|---|---|
protected |
V8() |
protected |
V8(String globalAlias) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
add(long v8RuntimePtr,
long objectHandle,
String key,
boolean value) |
protected void |
add(long v8RuntimePtr,
long objectHandle,
String key,
double value) |
protected void |
add(long v8RuntimePtr,
long objectHandle,
String key,
int value) |
protected void |
add(long v8RuntimePtr,
long objectHandle,
String key,
String value) |
protected void |
addArrayBooleanItem(long v8RuntimePtr,
long arrayHandle,
boolean value) |
protected void |
addArrayDoubleItem(long v8RuntimePtr,
long arrayHandle,
double value) |
protected void |
addArrayIntItem(long v8RuntimePtr,
long arrayHandle,
int value) |
protected void |
addArrayNullItem(long v8RuntimePtr,
long arrayHandle) |
protected void |
addArrayObjectItem(long v8RuntimePtr,
long arrayHandle,
long value) |
protected void |
addArrayStringItem(long v8RuntimePtr,
long arrayHandle,
String value) |
protected void |
addArrayUndefinedItem(long v8RuntimePtr,
long arrayHandle) |
protected void |
addNull(long v8RuntimePtr,
long objectHandle,
String key) |
protected void |
addObject(long v8RuntimePtr,
long objectHandle,
String key,
long value) |
protected void |
addUndefined(long v8RuntimePtr,
long objectHandle,
String key) |
protected Object |
arrayGet(long v8RuntimePtr,
int expectedType,
long arrayHandle,
int index) |
protected boolean |
arrayGetBoolean(long v8RuntimePtr,
long arrayHandle,
int index) |
protected boolean[] |
arrayGetBooleans(long v8RuntimePtr,
long objectHandle,
int index,
int length) |
protected int |
arrayGetBooleans(long v8RuntimePtr,
long objectHandle,
int index,
int length,
boolean[] resultArray) |
protected double |
arrayGetDouble(long v8RuntimePtr,
long arrayHandle,
int index) |
protected double[] |
arrayGetDoubles(long v8RuntimePtr,
long objectHandle,
int index,
int length) |
protected int |
arrayGetDoubles(long v8RuntimePtr,
long objectHandle,
int index,
int length,
double[] resultArray) |
protected int |
arrayGetInteger(long v8RuntimePtr,
long arrayHandle,
int index) |
protected int[] |
arrayGetIntegers(long v8RuntimePtr,
long objectHandle,
int index,
int length) |
protected int |
arrayGetIntegers(long v8RuntimePtr,
long objectHandle,
int index,
int length,
int[] resultArray) |
protected int |
arrayGetSize(long v8RuntimePtr,
long arrayHandle) |
protected String |
arrayGetString(long v8RuntimePtr,
long arrayHandle,
int index) |
protected String[] |
arrayGetStrings(long v8RuntimePtr,
long objectHandle,
int index,
int length) |
protected int |
arrayGetStrings(long v8RuntimePtr,
long objectHandle,
int index,
int length,
String[] resultArray) |
protected Object |
callObjectJavaMethod(int methodID,
V8Object receiver,
V8Array parameters) |
protected void |
callVoidJavaMethod(int methodID,
V8Object receiver,
V8Array parameters) |
protected boolean |
contains(long v8RuntimePtr,
long objectHandle,
String key) |
protected void |
createTwin(long v8RuntimePtr,
long objectHandle,
long twinHandle) |
protected void |
createTwin(V8Value value,
V8Value twin) |
static V8 |
createV8Runtime()
Creates a new V8Runtime and loads the required
native libraries if they are not already loaded.
|
static V8 |
createV8Runtime(String globalAlias)
Creates a new V8Runtime and loads the required native libraries if they
are not already loaded.
|
static V8 |
createV8Runtime(String globalAlias,
String tempDirectory)
Creates a new V8Runtime and loads the required native libraries if they
are not already loaded.
|
protected static void |
debugMessageReceived() |
void |
disableDebugSupport()
Deprecated.
|
protected void |
disableDebugSupport(long v8RuntimePtr) |
boolean |
enableDebugSupport(int port)
Deprecated.
NOTE: This is not API and likely to change
|
boolean |
enableDebugSupport(int port,
boolean waitForConnection)
Deprecated.
NOTE: This is not API and likely to change
|
protected boolean |
enableDebugSupport(long v8RuntimePtr,
int port,
boolean waitForConnection) |
protected boolean |
equals(long v8RuntimePtr,
long objectHandle,
long that) |
V8Array |
executeArrayScript(String script)
Executes a JS Script on this runtime and returns the result as a V8Array.
|
V8Array |
executeArrayScript(String script,
String scriptName,
int lineNumber)
Executes a JS Script on this runtime and returns the result as a V8Array.
|
protected boolean |
executeBooleanFunction(long v8RuntimePtr,
long handle,
String name,
long parametersHandle) |
protected boolean |
executeBooleanScript(long v8RuntimePtr,
String script,
String scriptName,
int lineNumber) |
boolean |
executeBooleanScript(String script)
Executes a JS Script on this runtime and returns the result as a boolean.
|
boolean |
executeBooleanScript(String script,
String scriptName,
int lineNumber)
Executes a JS Script on this runtime and returns the result as a boolean.
|
protected double |
executeDoubleFunction(long v8RuntimePtr,
long objectHandle,
String name,
long parametersHandle) |
protected double |
executeDoubleScript(long v8RuntimePtr,
String script,
String scriptName,
int lineNumber) |
double |
executeDoubleScript(String script)
Executes a JS Script on this runtime and returns the result as a double.
|
double |
executeDoubleScript(String script,
String scriptName,
int lineNumber)
Executes a JS Script on this runtime and returns the result as a double.
|
protected Object |
executeFunction(long v8RuntimePtr,
int expectedType,
long objectHandle,
String name,
long parametersHandle) |
protected Object |
executeFunction(long v8RuntimePtr,
long receiverHandle,
long functionHandle,
long parametersHandle) |
protected int |
executeIntegerFunction(long v8RuntimePtr,
long objectHandle,
String name,
long parametersHandle) |
protected int |
executeIntegerScript(long v8RuntimePtr,
String script,
String scriptName,
int lineNumber) |
int |
executeIntegerScript(String script)
Executes a JS Script on this runtime and returns the result as an integer.
|
int |
executeIntegerScript(String script,
String scriptName,
int lineNumber)
Executes a JS Script on this runtime and returns the result as an integer.
|
V8Object |
executeObjectScript(String script)
Executes a JS Script on this runtime and returns the result as a V8Object.
|
V8Object |
executeObjectScript(String script,
String scriptName,
int lineNumber)
Executes a JS Script on this runtime and returns the result as a V8Object.
|
protected Object |
executeScript(long v8RuntimePtr,
int expectedType,
String script,
String scriptName,
int lineNumber) |
Object |
executeScript(String script)
Executes a JS Script on this runtime and returns the result as a Java Object.
|
Object |
executeScript(String script,
String scriptName,
int lineNumber)
Executes a JS Script on this runtime and returns the result as a Java Object.
|
protected String |
executeStringFunction(long v8RuntimePtr,
long handle,
String name,
long parametersHandle) |
protected String |
executeStringScript(long v8RuntimePtr,
String script,
String scriptName,
int lineNumber) |
String |
executeStringScript(String script)
Executes a JS Script on this runtime and returns the result as a String.
|
String |
executeStringScript(String script,
String scriptName,
int lineNumber)
Executes a JS Script on this runtime and returns the result as a String.
|
protected void |
executeVoidFunction(long v8RuntimePtr,
long objectHandle,
String name,
long parametersHandle) |
protected void |
executeVoidScript(long v8RuntimePtr,
String script,
String scriptName,
int lineNumber) |
void |
executeVoidScript(String script)
Executes a JS Script on this runtime.
|
void |
executeVoidScript(String script,
String scriptName,
int lineNumber)
Executes a JS Script on this runtime.
|
protected Object |
get(long v8RuntimePtr,
int expectedType,
long objectHandle,
String key) |
static int |
getActiveRuntimes()
Returns the number of active runtimes.
|
protected int |
getArrayType(long v8RuntimePtr,
long objectHandle) |
protected boolean |
getBoolean(long v8RuntimePtr,
long objectHandle,
String key) |
long |
getBuildID()
Returns the unique build ID of the native library.
|
protected double |
getDouble(long v8RuntimePtr,
long objectHandle,
String key) |
V8Executor |
getExecutor(V8Object key)
Returns the executor associated with the given key.
|
protected int |
getInteger(long v8RuntimePtr,
long objectHandle,
String key) |
protected String[] |
getKeys(long v8RuntimePtr,
long objectHandle) |
V8Locker |
getLocker()
Returns the locker associated with this runtime.
|
protected String |
getString(long v8RuntimePtr,
long objectHandle,
String key) |
protected int |
getType(long v8RuntimePtr,
long objectHandle,
int index) |
protected int |
getType(long v8RuntimePtr,
long objectHandle,
int index,
int length) |
protected int |
getType(long v8RuntimePtr,
long objectHandle,
String key) |
static V8Value |
getUndefined()
Returns an UNDEFINED constant.
|
protected long |
getV8RuntimePtr() |
protected int |
identityHash(long v8RuntimePtr,
long objectHandle) |
protected long |
initNewV8Array(long v8RuntimePtr) |
protected long |
initNewV8Object(long v8RuntimePtr) |
static boolean |
isLoaded()
Determines if the native libraries are loaded.
|
protected void |
processDebugMessages(long v8RuntimePtr) |
static void |
processDebugMessages(V8 runtime)
Deprecated.
|
static void |
registerDebugHandler(Runnable handler)
Deprecated.
|
protected void |
registerJavaMethod(long v8RuntimePtr,
long objectHandle,
String functionName,
int methodID,
boolean voidMethod) |
void |
registerResource(Releasable resource)
Registers a resource with this runtime.
|
void |
registerV8Executor(V8Object key,
V8Executor executor)
Registers an executor with this runtime.
|
void |
release()
Releases the native resources associated with this V8Value.
|
void |
release(boolean reportMemoryLeaks)
Release native resources associated with this runtime.
|
protected void |
release(long v8RuntimePtr,
long objectHandle) |
V8Executor |
removeExecutor(V8Object key)
Removes the executor from this runtime.
|
protected boolean |
sameValue(long v8RuntimePtr,
long objectHandle,
long that) |
protected void |
setPrototype(long v8RuntimePtr,
long objectHandle,
long prototypeHandle) |
void |
shutdownExecutors(boolean forceTerminate)
Shutdown all executors associated with this runtime.
|
protected boolean |
strictEquals(long v8RuntimePtr,
long objectHandle,
long that) |
void |
terminateExecution()
Terminates any JavaScript executing on this runtime.
|
protected void |
terminateExecution(long v8RuntimePtr) |
add, add, add, add, add, addNull, addUndefined, contains, createTwin, executeArrayFunction, executeBooleanFunction, executeDoubleFunction, executeFunction, executeIntegerFunction, executeObjectFunction, executeStringFunction, executeVoidFunction, get, getArray, getBoolean, getDouble, getInteger, getKeys, getObject, getString, getType, registerJavaMethod, registerJavaMethod, registerJavaMethod, registerJavaMethod, setPrototype, toString, twincheckReleaesd, equals, getHandle, getRuntime, getRutime, hashCode, initialize, isReleased, isUndefined, jsEquals, strictEqualsprotected V8()
protected V8(String globalAlias)
public static boolean isLoaded()
public static V8 createV8Runtime()
public static V8 createV8Runtime(String globalAlias)
globalAlias - The name to associate with the global scope.public static V8 createV8Runtime(String globalAlias, String tempDirectory)
globalAlias - The name to associate with the global scope.tempDirectory - The name of the directory to extract the native
libraries too.public static V8Value getUndefined()
@Deprecated public boolean enableDebugSupport(int port, boolean waitForConnection)
port - The port to listen for debug connections.waitForConnection - True if the runtime should wait on the first
instruction for the debugger to connect.@Deprecated public boolean enableDebugSupport(int port)
port - The port to listen for debug connections.@Deprecated public static void processDebugMessages(V8 runtime)
@Deprecated public void disableDebugSupport()
@Deprecated public static void registerDebugHandler(Runnable handler)
handler - The debug handler to invoke when a debug message
is received.public static int getActiveRuntimes()
protected long getV8RuntimePtr()
public void release()
V8Valuerelease in interface Releasablerelease in class V8Valuepublic void terminateExecution()
public void release(boolean reportMemoryLeaks)
reportMemoryLeaks - True if memory leaks should be
reported by throwing an IllegalStateException if any
objects were not released.public void registerV8Executor(V8Object key, V8Executor executor)
key - The key to associate the executor with.executor - The executor itself.public V8Executor removeExecutor(V8Object key)
key - The key the executor was associated with.public V8Executor getExecutor(V8Object key)
key - The key the executor was associated with.public void shutdownExecutors(boolean forceTerminate)
forceTerminate - Specify if the executors should be
forcefully terminated, or simply notified to shutdown when ready.public void registerResource(Releasable resource)
resource - The resource to register.public int executeIntegerScript(String script)
script - The script to execute.public int executeIntegerScript(String script, String scriptName, int lineNumber)
script - The script to execute.scriptName - The name of the scriptlineNumber - The line number that is considered to be the first line of
the script. Typically 0, but could be set to another value for excepton purposes.public double executeDoubleScript(String script)
script - The script to execute.public double executeDoubleScript(String script, String scriptName, int lineNumber)
script - The script to execute.scriptName - The name of the scriptlineNumber - The line number that is considered to be the first line of
the script. Typically 0, but could be set to another value for exception stack trace purposes.public String executeStringScript(String script)
script - The script to execute.public String executeStringScript(String script, String scriptName, int lineNumber)
script - The script to execute.scriptName - The name of the scriptlineNumber - The line number that is considered to be the first line of
the script. Typically 0, but could be set to another value for exception stack trace purposes.public boolean executeBooleanScript(String script)
script - The script to execute.public boolean executeBooleanScript(String script, String scriptName, int lineNumber)
script - The script to execute.scriptName - The name of the scriptlineNumber - The line number that is considered to be the first line of
the script. Typically 0, but could be set to another value for exception stack trace purposes.public V8Array executeArrayScript(String script)
script - The script to execute.public V8Array executeArrayScript(String script, String scriptName, int lineNumber)
script - The script to execute.scriptName - The name of the scriptlineNumber - The line number that is considered to be the first line of
the script. Typically 0, but could be set to another value for exception stack trace purposes.public Object executeScript(String script)
script - The script to execute.public Object executeScript(String script, String scriptName, int lineNumber)
script - The script to execute.scriptName - The name of the scriptlineNumber - The line number that is considered to be the first line of
the script. Typically 0, but could be set to another value for exception stack trace purposes.public V8Object executeObjectScript(String script)
script - The script to execute.public V8Object executeObjectScript(String script, String scriptName, int lineNumber)
script - The script to execute.scriptName - The name of the scriptlineNumber - The line number that is considered to be the first line of
the script. Typically 0, but could be set to another value for exception stack trace purposes.public void executeVoidScript(String script)
script - The script to execute.public void executeVoidScript(String script, String scriptName, int lineNumber)
script - The script to execute.scriptName - The name of the scriptlineNumber - The line number that is considered to be the first line of
the script. Typically 0, but could be set to another value for exception stack trace purposes.public V8Locker getLocker()
public long getBuildID()
protected Object callObjectJavaMethod(int methodID, V8Object receiver, V8Array parameters) throws Throwable
Throwableprotected void callVoidJavaMethod(int methodID,
V8Object receiver,
V8Array parameters)
throws Throwable
Throwableprotected static void debugMessageReceived()
protected long initNewV8Object(long v8RuntimePtr)
protected void createTwin(long v8RuntimePtr,
long objectHandle,
long twinHandle)
protected int executeIntegerScript(long v8RuntimePtr,
String script,
String scriptName,
int lineNumber)
protected double executeDoubleScript(long v8RuntimePtr,
String script,
String scriptName,
int lineNumber)
protected String executeStringScript(long v8RuntimePtr, String script, String scriptName, int lineNumber)
protected boolean executeBooleanScript(long v8RuntimePtr,
String script,
String scriptName,
int lineNumber)
protected Object executeScript(long v8RuntimePtr, int expectedType, String script, String scriptName, int lineNumber)
protected void executeVoidScript(long v8RuntimePtr,
String script,
String scriptName,
int lineNumber)
protected void release(long v8RuntimePtr,
long objectHandle)
protected boolean contains(long v8RuntimePtr,
long objectHandle,
String key)
protected String[] getKeys(long v8RuntimePtr, long objectHandle)
protected int getInteger(long v8RuntimePtr,
long objectHandle,
String key)
protected boolean getBoolean(long v8RuntimePtr,
long objectHandle,
String key)
protected double getDouble(long v8RuntimePtr,
long objectHandle,
String key)
protected int executeIntegerFunction(long v8RuntimePtr,
long objectHandle,
String name,
long parametersHandle)
protected double executeDoubleFunction(long v8RuntimePtr,
long objectHandle,
String name,
long parametersHandle)
protected String executeStringFunction(long v8RuntimePtr, long handle, String name, long parametersHandle)
protected boolean executeBooleanFunction(long v8RuntimePtr,
long handle,
String name,
long parametersHandle)
protected Object executeFunction(long v8RuntimePtr, int expectedType, long objectHandle, String name, long parametersHandle)
protected Object executeFunction(long v8RuntimePtr, long receiverHandle, long functionHandle, long parametersHandle)
protected void executeVoidFunction(long v8RuntimePtr,
long objectHandle,
String name,
long parametersHandle)
protected boolean equals(long v8RuntimePtr,
long objectHandle,
long that)
protected boolean strictEquals(long v8RuntimePtr,
long objectHandle,
long that)
protected boolean sameValue(long v8RuntimePtr,
long objectHandle,
long that)
protected int identityHash(long v8RuntimePtr,
long objectHandle)
protected void add(long v8RuntimePtr,
long objectHandle,
String key,
int value)
protected void addObject(long v8RuntimePtr,
long objectHandle,
String key,
long value)
protected void add(long v8RuntimePtr,
long objectHandle,
String key,
boolean value)
protected void add(long v8RuntimePtr,
long objectHandle,
String key,
double value)
protected void addUndefined(long v8RuntimePtr,
long objectHandle,
String key)
protected void addNull(long v8RuntimePtr,
long objectHandle,
String key)
protected void registerJavaMethod(long v8RuntimePtr,
long objectHandle,
String functionName,
int methodID,
boolean voidMethod)
protected long initNewV8Array(long v8RuntimePtr)
protected int arrayGetSize(long v8RuntimePtr,
long arrayHandle)
protected int arrayGetInteger(long v8RuntimePtr,
long arrayHandle,
int index)
protected boolean arrayGetBoolean(long v8RuntimePtr,
long arrayHandle,
int index)
protected double arrayGetDouble(long v8RuntimePtr,
long arrayHandle,
int index)
protected String arrayGetString(long v8RuntimePtr, long arrayHandle, int index)
protected Object arrayGet(long v8RuntimePtr, int expectedType, long arrayHandle, int index)
protected void addArrayIntItem(long v8RuntimePtr,
long arrayHandle,
int value)
protected void addArrayBooleanItem(long v8RuntimePtr,
long arrayHandle,
boolean value)
protected void addArrayDoubleItem(long v8RuntimePtr,
long arrayHandle,
double value)
protected void addArrayStringItem(long v8RuntimePtr,
long arrayHandle,
String value)
protected void addArrayObjectItem(long v8RuntimePtr,
long arrayHandle,
long value)
protected void addArrayUndefinedItem(long v8RuntimePtr,
long arrayHandle)
protected void addArrayNullItem(long v8RuntimePtr,
long arrayHandle)
protected int getType(long v8RuntimePtr,
long objectHandle,
String key)
protected int getType(long v8RuntimePtr,
long objectHandle,
int index)
protected int getArrayType(long v8RuntimePtr,
long objectHandle)
protected int getType(long v8RuntimePtr,
long objectHandle,
int index,
int length)
protected void setPrototype(long v8RuntimePtr,
long objectHandle,
long prototypeHandle)
protected boolean enableDebugSupport(long v8RuntimePtr,
int port,
boolean waitForConnection)
protected void disableDebugSupport(long v8RuntimePtr)
protected void processDebugMessages(long v8RuntimePtr)
protected int[] arrayGetIntegers(long v8RuntimePtr,
long objectHandle,
int index,
int length)
protected double[] arrayGetDoubles(long v8RuntimePtr,
long objectHandle,
int index,
int length)
protected boolean[] arrayGetBooleans(long v8RuntimePtr,
long objectHandle,
int index,
int length)
protected String[] arrayGetStrings(long v8RuntimePtr, long objectHandle, int index, int length)
protected int arrayGetIntegers(long v8RuntimePtr,
long objectHandle,
int index,
int length,
int[] resultArray)
protected int arrayGetDoubles(long v8RuntimePtr,
long objectHandle,
int index,
int length,
double[] resultArray)
protected int arrayGetBooleans(long v8RuntimePtr,
long objectHandle,
int index,
int length,
boolean[] resultArray)
protected int arrayGetStrings(long v8RuntimePtr,
long objectHandle,
int index,
int length,
String[] resultArray)
protected void terminateExecution(long v8RuntimePtr)
Copyright © 2015. All rights reserved.