public Media (String source)

Constructs a Media instance. This is the only way to specify the media source. The source must represent a valid URI and is immutable. Only HTTP, HTTPS, FILE, and JAR URLs are supported. If the provided URL is invalid then an exception will be thrown. If an asynchronous error occurs, the error property will be set. Listen to this property to be notified of any such errors.

If the source uses a non-blocking protocol such as FILE, then any problems which can be detected immediately will cause a MediaException to be thrown. Such problems include the media being inaccessible or in an unsupported format. If however a potentially blocking protocol such as HTTP is used, then the connection will be initialized asynchronously so that these sorts of errors will be signaled by setting the error property.

Constraints:

See java.net.URI for more information about URI formatting in general. JAR URL syntax is specified in java.net.JarURLConnection.

Parameters:
source    The URI of the source media.

Exceptions:
NullPointerException    if the URI string is null.
IllegalArgumentException    if the URI string does not conform to RFC-2396 or, if appropriate, the Jar URL specification, or is in a non-compliant form which cannot be modified to a compliant form.
IllegalArgumentException    if the URI string has a null scheme.
UnsupportedOperationException    if the protocol specified for the source is not supported.
MediaException    if the media source cannot be connected (type MediaException.Type.MEDIA_INACCESSIBLE) or is not supported (type MediaException.Type.MEDIA_UNSUPPORTED).