|
||||||||
PREV CLASS NEXT CLASS | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.w3c.css.sac.InputSource
A single input source for a CSS source.
This class allows a CSS application to encapsulate information about an input source in a single object, which may include a URI, a byte stream (possibly with a specified encoding), and/or a character stream.
The CSS parser will use the InputSource object to determine how to read CSS input. If there is a character stream available, the parser will read that stream directly; if not, the parser will use a byte stream, if available; if neither a character stream nor a byte stream is available, the parser will attempt to open a URI connection to the resource identified by the URI.
An InputSource object belongs to the application: the CSS parser shall never modify it in any way (it may modify a copy if necessary).
Constructor Summary | |
InputSource()
Zero-argument default constructor. |
|
InputSource(java.io.Reader characterStream)
Create a new input source with a character stream. |
|
InputSource(java.lang.String uri) Create a new input source with a URI. |
Method Summary | |
java.io.InputStream |
getByteStream()
Get the byte stream for this input source. |
java.io.Reader |
getCharacterStream() Get the character stream for this input source. |
java.lang.String |
getEncoding()
Get the character encoding for a byte stream or URI. |
java.lang.String |
getMedia()
Returns the media associated to the input source or null if
media are currently unknown. |
java.lang.String |
getTitle()
Returns the title for this input source. |
java.lang.String |
getURI()
Get the URI for this input source. |
void |
setByteStream(java.io.InputStream byteStream)
Set the byte stream for this input source. |
void |
setCharacterStream(java.io.Reader characterStream)
Set the character stream for this input source. |
void |
setEncoding(java.lang.String encoding) Set the character encoding, if known. |
void |
setMedia(java.lang.String media) Set the media for this input source. |
void |
setTitle(java.lang.String title) Set the title for this input source. |
void |
setURI(java.lang.String uri) Set the URI for this input source. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify,
notifyAll, toString, wait, wait, wait |
Constructor Detail |
public InputSource()
setURI(java.lang.String)
,
setByteStream(java.io.InputStream)
,
setCharacterStream(java.io.Reader)
,
setEncoding(java.lang.String)
public InputSource(java.io.Reader characterStream)
Application writers may use setURI() to provide a base for resolving relative URIs, and setPublicId to include a public identifier.
The character stream shall not include a byte order mark.
setURI(java.lang.String)
,
setByteStream(java.io.InputStream)
,
setCharacterStream(java.io.Reader)
public InputSource(java.lang.String uri)
The URI must be full resolved.
uri
- The URI.setURI(java.lang.String)
,
setByteStream(java.io.InputStream)
,
setEncoding(java.lang.String)
,
setCharacterStream(java.io.Reader)
Method Detail |
public java.io.InputStream getByteStream()
The getEncoding method will return the character encoding for this byte stream, or null if unknown.
getEncoding()
,
setByteStream(java.io.InputStream)
public java.io.Reader getCharacterStream()
setCharacterStream(java.io.Reader)
public java.lang.String getEncoding()
setByteStream(java.io.InputStream)
, getURI()
,
getByteStream()
public java.lang.String getMedia()
null
if media are currently unknown.public java.lang.String getTitle()
public java.lang.String getURI()
The getEncoding method will return the character encoding of the object pointed to, or null if unknown.
The URI will be fully resolved.
setURI(java.lang.String)
, getEncoding()
public void setByteStream(java.io.InputStream byteStream)
The SAX parser will ignore this if there is also a character stream specified, but it will use a byte stream in preference to opening a URI connection itself.
If the application knows the character encoding of the byte stream, it should set it with the setEncoding method.
byteStream
- A byte stream containing an CSS
document or other entity.setEncoding(java.lang.String)
,
getByteStream()
, getEncoding()
public void setCharacterStream(java.io.Reader characterStream)
If there is a character stream specified, the SAX parser will ignore any byte stream and will not attempt to open a URI connection to the URI.
characterStream
- The character stream containing
the CSS document or other entity.getCharacterStream()
public void setEncoding(java.lang.String encoding)
The encoding must be a string acceptable for an CHARSET encoding declaration (see section 4.4 of the CSS recommendation Level 2).
This method has no effect when the application provides a character stream.
encoding
- A string describing the character
encoding.setURI(java.lang.String)
,
setByteStream(java.io.InputStream)
, getEncoding()
public void setMedia(java.lang.String media)
media
- A comma separated list with all
media.public void setTitle(java.lang.String title)
title
- The advisory title. See the title
attribute definition for the LINK
element in HTML 4.0, and the title pseudo-attribute for the XML
style sheet processing instruction.public void setURI(java.lang.String uri)
The URI is optional if there is a byte stream or a character stream, but it is still useful to provide one, since the application can use it to resolve relative URIs and can include it in error messages and warnings (the parser will attempt to open a connection to the URI only if there is no byte stream or character stream specified).
If the application knows the character encoding of the object pointed to by the URI, it can register the encoding using the setEncoding method.
The URI must be fully resolved.
uri
- The URI as a string.setEncoding(java.lang.String)
, getURI()
,
Locator.getURI()
,
CSSParseException.getURI()
|
||||||||
PREV CLASS NEXT CLASS | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2002 W3C® (MIT, INRIA, Keio), All Rights Reserved. W3C liability, trademark, document use and software licensing rules apply. Your interactions with this site are in accordance with our public and Member privacy statements.