Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## fr.jayasoft.ivy.url
Class URLHandlerDispatcher

    java.lang.Object
      fr.jayasoft.ivy.url.URLHandlerDispatcher

All Implemented Interfaces:
  URLHandler

public class URLHandlerDispatcher
extends java.lang.Object
implements URLHandler

This class is used to dispatch downloading requests

Author:
  Xavier Hanin

Nested Class Summary

Nested classes inherited from class fr.jayasoft.ivy.url.URLHandler
`URLHandler.URLInfo`

Field Summary
`protected URLHandler` | `_default`
`protected java.util.Map` | `_handlers`

Fields inherited from interface fr.jayasoft.ivy.url.URLHandler
`UNAVAILABLE`

Constructor Summary
`URLHandlerDispatcher()`

Method Summary
`void` | `download(java.net.URL src, java.io.File dest, CopyProgressListener l)`
`long` | `getContentLength(java.net.URL url)` Returns the length of the target if the given url is reachable, and without error code in case of http urls.
`long` | `getContentLength(java.net.URL url, int timeout)` Returns the length of the target if the given url is reachable, and without error code in case of http urls.
`URLHandler` | `getDefault()`
`URLHandler` | `getHandler(java.lang.String protocol)`
`long` | `getLastModified(java.net.URL url)` Please prefer getURLInfo when several infos are needed.
`long` | `getLastModified(java.net.URL url, int timeout)` Please prefer getURLInfo when several infos are needed.
`URLHandler.URLInfo` | `getURLInfo(java.net.URL url)` never returns null, return UNAVAILABLE when url is not reachable
`URLHandler.URLInfo` | `getURLInfo(java.net.URL url, int timeout)` never returns null, return UNAVAILABLE when url is not reachable
`boolean` | `isReachable(java.net.URL url)` Please prefer getURLInfo when several infos are needed.
`boolean` | `isReachable(java.net.URL url, int timeout)` Please prefer getURLInfo when several infos are needed.
`java.io.InputStream` | `openStream(java.net.URL url)`
`void` | `setDefault(URLHandler default1)`
`void` | `setDownloader(java.lang.String protocol, URLHandler downloader)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### _handlers

    protected java.util.Map _handlers

### _default

    protected URLHandler _default

Constructor Detail

### URLHandlerDispatcher

    public URLHandlerDispatcher()

Method Detail

### isReachable

    public boolean isReachable(java.net.URL url)

  Description copied from interface: `URLHandler`
  Please prefer getURLInfo when several infos are needed.

  Specified by:
    `isReachable` in interface `URLHandler`
  Parameters:
    `url` - the url to check
  Returns:
    true if the target is reachable

### isReachable

    public boolean isReachable(java.net.URL url,
                               int timeout)

  Description copied from interface: `URLHandler`
  Please prefer getURLInfo when several infos are needed.

  Specified by:
    `isReachable` in interface `URLHandler`
  Parameters:
    `url` - the url to check
  Returns:
    true if the target is reachable

### getContentLength

    public long getContentLength(java.net.URL url)

  Description copied from interface: `URLHandler`
  Returns the length of the target if the given url is reachable, and without error code in case of http urls. Please prefer getURLInfo when several infos are needed.

  Specified by:
    `getContentLength` in interface `URLHandler`
  Parameters:
    `url` - the url to check
  Returns:
    the length of the target if available, 0 if not reachable

### getContentLength

    public long getContentLength(java.net.URL url,
                                 int timeout)

  Description copied from interface: `URLHandler`
  Returns the length of the target if the given url is reachable, and without error code in case of http urls.

  Specified by:
    `getContentLength` in interface `URLHandler`
  Parameters:
    `url` - the url to check
    `timeout` - the maximum time before considering an url is not reachable a timeout of zero indicates no timeout
  Returns:
    the length of the target if available, 0 if not reachable

### getLastModified

    public long getLastModified(java.net.URL url)

  Description copied from interface: `URLHandler`
  Please prefer getURLInfo when several infos are needed.

  Specified by:
    `getLastModified` in interface `URLHandler`
  Parameters:
    `url` - the url to check
  Returns:
    last modified timestamp of the given url

### getLastModified

    public long getLastModified(java.net.URL url,
                                int timeout)

  Description copied from interface: `URLHandler`
  Please prefer getURLInfo when several infos are needed.

  Specified by:
    `getLastModified` in interface `URLHandler`
  Parameters:
    `url` - the url to check
  Returns:
    last modified timestamp of the given url

### getURLInfo

    public URLHandler.URLInfo getURLInfo(java.net.URL url)

  Description copied from interface: `URLHandler`
  never returns null, return UNAVAILABLE when url is not reachable

  Specified by:
    `getURLInfo` in interface `URLHandler`
  Parameters:
    `url` -
  Returns:

### getURLInfo

    public URLHandler.URLInfo getURLInfo(java.net.URL url,
                                         int timeout)

  Description copied from interface: `URLHandler`
  never returns null, return UNAVAILABLE when url is not reachable

  Specified by:
    `getURLInfo` in interface `URLHandler`
  Parameters:
    `url` -
  Returns:

### openStream

    public java.io.InputStream openStream(java.net.URL url)
                                   throws java.io.IOException

  Specified by:
    `openStream` in interface `URLHandler`
  Throws:
    `java.io.IOException`

### download

    public void download(java.net.URL src,
                         java.io.File dest,
                         CopyProgressListener l)
                  throws java.io.IOException

  Specified by:
    `download` in interface `URLHandler`
  Throws:
    `java.io.IOException`

### setDownloader

    public void setDownloader(java.lang.String protocol,
                              URLHandler downloader)

### getHandler

    public URLHandler getHandler(java.lang.String protocol)

### getDefault

    public URLHandler getDefault()

### setDefault

    public void setDefault(URLHandler default1)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD