public class Locator extends Object
Locator
which refers to a
URI
.Modifier and Type | Field and Description |
---|---|
protected long |
contentLength
A hint for the internal player.
|
protected String |
contentType
The content type of the media content.
|
static String |
DEFAULT_CONTENT_TYPE
The content type used if no more specific one may be derived.
|
protected URI |
uri
The URI source.
|
Constructor and Description |
---|
Locator(URI uri)
Constructs an object representing a media source.
|
Modifier and Type | Method and Description |
---|---|
void |
cacheMedia()
Tell this Locator to preload the media into memory, if it hasn't been
already.
|
boolean |
canBlock() |
ConnectionHolder |
createConnectionHolder() |
long |
getContentLength()
Retrieves the media size.
|
String |
getContentType()
Retrieves the content type describing the media content or
"application/octet-stream" if no more specific content type
may be detected. |
String |
getProtocol()
Retrieves the protocol of the media URL
|
String |
getStringLocation() |
URI |
getURI()
Retrieves the associated
URI . |
void |
init() |
void |
setConnectionProperty(String property,
Object value)
Sets a property to be used by the connection to the media specified by
the URI.
|
String |
toString()
Retrieves a string representation of the
Locator |
void |
waitForReadySignal()
Blocks until locator is ready (connection is established or failed).
|
public static final String DEFAULT_CONTENT_TYPE
protected String contentType
protected long contentLength
protected URI uri
public Locator(URI uri) throws URISyntaxException
uri
- The URI source.NullPointerException
- if
uri
is
null
.IllegalArgumentException
- if the URI's scheme is
null
.URISyntaxException
- if the supplied URI requires some further
manipulation in order to be used and this procedure fails to produce a
usable URI.IllegalArgumentException
- if the URI is a Jar URL as described in
https://docs.oracle.com/javase/8/docs/api/java/net/JarURLConnection.html
,
and the scheme of the URL after removing the leading four characters is
null
.UnsupportedOperationException
- if the URI's protocol is
unsupported.public void cacheMedia()
public boolean canBlock()
public void init() throws URISyntaxException, IOException, FileNotFoundException
public String getContentType()
"application/octet-stream"
if no more specific content type
may be detected.public String getProtocol()
public long getContentLength()
public void waitForReadySignal()
public URI getURI()
URI
.public String toString()
Locator
public String getStringLocation()
public void setConnectionProperty(String property, Object value)
createConnectionHolder()
or it will have no effect.property
- The name of the property.value
- The value of the property.public ConnectionHolder createConnectionHolder() throws IOException
IOException
Copyright © 2020. All rights reserved.