Class Java

Description

The Java proxy class.

The Java proxy class. Use this class to create a Java instance. Use the Java function to access a Java type. Example which creates an instance:

  1.  $s new Java("java.lang.String""hello");

Any declared exception can be caught by PHP code.
Exceptions derived from java.lang.RuntimeException or Error should not be caught unless declared in the methods throws clause -- OutOfMemoryErrors cannot be caught at all, even if declared.

Located in /JavaProxy.inc (line 826)

java_AbstractJava
   |
   --Java
Method Summary
Java Java ()
void __call (string $method, array $args)
Methods
Constructor Java (line 868)

Create a new instance.

Create a new instance. This constructor can be used to create an instance of a Java class to access its features.
To access constants or procedures within a class, use the java function instead.
To convert a Java object into a PHP value, use the java_values() function.
Example which creates an instance:

  1.  $s new Java("java.lang.String""hello");
Example which accesses the System class:
  1.  $s Java("java.lang.System");
If the option JAVA_PREFER_VALUES is set, Java values are automatically coerced to PHP values. Example which sets the option JAVA_PREFER_VALUES:
  1.  define("JAVA_PREFER_VALUES"true);
  2.  require_once("java/Java.inc");
  3.  ...
  4.  if (java("java.lang.System")->getProperty("foo"false)) ...
Otherwise java_values() must be used to fetch a PHP value from a Java object or Java value. The same example which usually executes 5 times faster:
  1.  require_once("java/Java.inc");
  2.  ...
  3.  if (java_values(java("java.lang.System")->getProperty("foo"false))) ...

Java Java ()
__call (line 968)

Call a method on a Java object

Call a method on a Java object Example:

  1.  $s->substring(110);

void __call (string $method, array $args)
  • string $method: The method name
  • array $args: The argument array

Documentation generated on Sun, 06 Dec 2009 17:38:21 +0100 by phpDocumentor 1.4.2