|
Lizzy v1.1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object christophedelory.content.Content
public class Content
The definition of a content and its metadata.
Constructor Summary | |
---|---|
Content(String url)
Builds a new content from the specified URL. |
|
Content(URI uri)
Builds a new content from the specified URI. |
|
Content(URL url)
Builds a new content from the specified URL. |
Method Summary | |
---|---|
void |
connect()
Connects to the specified URL, if not already done. |
boolean |
equals(Object obj)
Indicates whether some other object is "equal to" this one. |
long |
getDuration()
Returns the content duration in milliseconds. |
String |
getEncoding()
Returns the content encoding of the resource that the URL references. |
int |
getHeight()
Returns the content height in pixels. |
long |
getLastModified()
Returns the date the resource that the URL references was last modified. |
long |
getLength()
Returns the content length in bytes of the resource that the URL references. |
String |
getType()
Returns the content type of the resource that the URL references. |
URI |
getURI()
Returns the URI of the content. |
URL |
getURL()
Returns the URL of the content. |
int |
getWidth()
Returns the content width in pixels. |
int |
hashCode()
Returns a hash code value for this object. |
boolean |
isValid()
Specifies if the last connection to the content through its URL has been successful or not. |
void |
setDuration(long duration)
Initializes the content duration in milliseconds. |
void |
setEncoding(String encoding)
Initializes or overrides the content encoding. |
void |
setHeight(int height)
Initializes or overrides the content height, in pixels. |
void |
setLastModified(long lastModified)
Initializes or overrides the last modified date. |
void |
setLength(long length)
Initializes or overrides the content length, in bytes. |
void |
setType(String type)
Initializes or overrides the content type. |
void |
setWidth(int width)
Initializes or overrides the content width, in pixels. |
String |
toString()
Returns the content URL as a string. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Content(String url)
url
- an URL as a string. Shall not be null
.
NullPointerException
- if url
is null
.public Content(URI uri)
uri
- an URI. Shall not be null
.
NullPointerException
- if uri
is null
.public Content(URL url)
url
- an URL. Shall not be null
.
NullPointerException
- if url
is null
.Method Detail |
---|
public URI getURI() throws URISyntaxException
null
.
SecurityException
- if a required system property value cannot be accessed.
URISyntaxException
- if this URL is not formatted strictly according to to RFC2396 and cannot be converted to a URI.getURL()
,
toString()
public URL getURL() throws MalformedURLException
null
.
SecurityException
- if a required system property value cannot be accessed.
IllegalArgumentException
- if the URL is not absolute.
MalformedURLException
- if a protocol handler for the URL could not be found, or if some other error occurred while constructing the URL.getURI()
,
toString()
public String getEncoding()
null
if unknown.setEncoding(java.lang.String)
public void setEncoding(String encoding)
encoding
- a content encoding. May be null
.getEncoding()
public long getLength()
-1L
if unknown.setLength(long)
public void setLength(long length)
length
- a content length. May be negative.getLength()
public String getType()
null
if unknown.setType(java.lang.String)
public void setType(String type)
type
- a content type. May be null
.getType()
public long getLastModified()
0L
if unknown.setLastModified(long)
public void setLastModified(long lastModified)
lastModified
- a date. May be negative or null.getLastModified()
public long getDuration()
setDuration(long)
public void setDuration(long duration)
duration
- a duration value. May be negative if unknown.getDuration()
public int getWidth()
-1
if unknown.setWidth(int)
public void setWidth(int width)
width
- a width. May be negative if unknown.getWidth()
public int getHeight()
-1
if unknown.setHeight(int)
public void setHeight(int height)
height
- an height. May be negative if unknown.getHeight()
public boolean isValid()
true
, the content metadata may be pertinent.
true
if the content has been successfully accessed through its URL, false
otherwise.connect()
public void connect() throws IOException
SecurityException
- if a required system property value cannot be accessed.
IllegalArgumentException
- if the URL is not absolute.
MalformedURLException
- if a protocol handler for the URL could not be found, or if some other error occurred while constructing the URL.
IOException
- if any I/O error occurs.
SocketTimeoutException
- if the timeout expires before the connection can be established.getURL()
public boolean equals(Object obj)
obj
: Content
, URL
, URI
, String
, etc.
equals
in class Object
obj
- the reference object with which to compare. May be null
.
true
if this object is the same as the obj
argument; false
otherwise.toString()
public int hashCode()
Hashtable
.
hashCode
in class Object
public String toString()
toString
in class Object
getURL()
,
getURI()
|
© 2008-2009 Christophe Delory | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |