### php.java.script

# Class URLReader

- `java.lang.Object`

- `java.io.Reader`

- `php.java.script.URLReader`

`public class URLReader`
`extends java.io.Reader`

This class can be used to connect to a HTTP server to allocate and to invoke php scripts. Example:

`PhpScriptEngine e = new PhpScriptEngine();
e.eval(new URLConnection(new URL("http://localhost:80/foo.php"));
System.out.println(((Invocable)e).call("java_get_server_name", new Object[]{}));
e.release();
`

Author:
  jostb

## Constructor Summary

`URLReader(java.net.URL url)`
  Create a special reader which can be used to read data from a URL.

## Method Summary

`void`

`close()`

`java.net.URL`

`getURL()`
  Returns the URL to which this reader connects.

`int`

`read(char[] cbuf, int off, int len)`

`void`

`read(java.util.Map env, java.io.OutputStream out)`
  Read from the URL and write the data to out.

`java.lang.String`

`toString()`

### Methods inherited from class java.io.Reader

`close`, `mark`, `markSupported`, `read`, `read`, `read`, `ready`, `reset`, `skip`

### Methods inherited from class java.lang.Object

`equals`, `getClass`, `hashCode`, `notify`, `notifyAll`, `toString`, `wait`, `wait`, `wait`

## Constructor Details

### URLReader

    public URLReader(java.net.URL url)
                throws java.net.UnknownHostException,
                       java.io.IOException

> Create a special reader which can be used to read data from a URL.

> Parameters:
>   `url` -

> Throws:
>   `java.io.IOException` -
>   `java.net.UnknownHostException` -

## Method Details

### close

    public void close()
                throws java.io.IOException

> Overrides:
>   close in interface java.io.Reader

> See Also:
>   `read(Map,OutputStream)`

### getURL

    public java.net.URL getURL()

> Returns the URL to which this reader connects.

> Returns:
>   the URL.

### read

    public int read(char[] cbuf,
                    int off,
                    int len)
                throws java.io.IOException

> See Also:
>   `read(Map,OutputStream)`

### read

    public void read(java.util.Map env,
                     java.io.OutputStream out)
                throws java.io.IOException

> Read from the URL and write the data to out.

> Parameters:
>   `env` - The environment, must contain values for X_JAVABRIDGE_CONTEXT. It may contain X_JAVABRIDGE_OVERRIDE_HOSTS.
>   `out` - The OutputStream.

> Throws:
>   `java.io.IOException` -

### toString

    public java.lang.String toString()

> Overrides:
>   toString in interface java.lang.Object