All Packages Class Hierarchy This Package Previous Next Index
Class org.w3c.css.sac.InputSource
java.lang.Object
|
+----org.w3c.css.sac.InputSource
- public class InputSource
- extends Object
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 Index
-
InputSource()
- Zero-argument default constructor.
-
InputSource(Reader)
- Create a new input source with a character stream.
-
InputSource(String)
- Create a new input source with a URI.
Method Index
-
getByteStream()
- Get the byte stream for this input source.
-
getCharacterStream()
- Get the character stream for this input source.
-
getEncoding()
- Get the character encoding for a byte stream or URI.
-
getMedia()
- Returns the media associated to the input source or
null
if media are currently unknown.
-
getTitle()
- Returns the title for this input source.
-
getURI()
- Get the URI for this input source.
-
setByteStream(InputStream)
- Set the byte stream for this input source.
-
setCharacterStream(Reader)
- Set the character stream for this input source.
-
setEncoding(String)
-
Set the character encoding, if known.
-
setMedia(String)
- Set the media for this input source.
-
setTitle(String)
- Set the title for this input source.
-
setURI(String)
- Set the URI for this input source.
Constructors
InputSource
public InputSource()
- Zero-argument default constructor.
- See Also:
- setURI, setByteStream, setCharacterStream, setEncoding
InputSource
public InputSource(String uri)
- Create a new input source with a URI.
The URI must be full resolved.
- Parameters:
- uri - The URI.
- See Also:
- setURI, setByteStream, setEncoding, setCharacterStream
InputSource
public InputSource(Reader characterStream)
- Create a new input source with a character stream.
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.
- See Also:
- setURI, setByteStream, setCharacterStream
Methods
setURI
public void setURI(String uri)
- Set the URI for this input source.
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.
- Parameters:
- uri - The URI as a string.
- See Also:
- setEncoding, getURI, getURI, getURI
getURI
public String getURI()
- Get the URI for this input source.
The getEncoding method will return the character encoding
of the object pointed to, or null if unknown.
The URI will be fully resolved.
- Returns:
- The URI.
- See Also:
- setURI, getEncoding
setByteStream
public void setByteStream(InputStream byteStream)
- Set the byte stream for this input source.
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.
- Parameters:
- byteStream - A byte stream containing an CSS document or
other entity.
- See Also:
- setEncoding, getByteStream, getEncoding
getByteStream
public InputStream getByteStream()
- Get the byte stream for this input source.
The getEncoding method will return the character
encoding for this byte stream, or null if unknown.
- Returns:
- The byte stream, or null if none was supplied.
- See Also:
- getEncoding, setByteStream
setEncoding
public void setEncoding(String encoding)
- Set the character encoding, if known.
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.
- Parameters:
- encoding - A string describing the character encoding.
- See Also:
- setURI, setByteStream, getEncoding
getEncoding
public String getEncoding()
- Get the character encoding for a byte stream or URI.
- Returns:
- The encoding, or null if none was supplied.
- See Also:
- setByteStream, getURI, getByteStream
setCharacterStream
public void setCharacterStream(Reader characterStream)
- Set the character stream for this input source.
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.
- Parameters:
- characterStream - The character stream containing the
CSS document or other entity.
- See Also:
- getCharacterStream
getCharacterStream
public Reader getCharacterStream()
- Get the character stream for this input source.
- Returns:
- The character stream, or null if none was supplied.
- See Also:
- setCharacterStream
setTitle
public void setTitle(String title)
- Set the title for this input source.
- Parameters:
- 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.
getTitle
public String getTitle()
- Returns the title for this input source.
setMedia
public void setMedia(String media)
- Set the media for this input source.
- Parameters:
- media - A comma separated list with all media.
getMedia
public String getMedia()
- Returns the media associated to the input source or
null
if media are currently unknown.
- Returns:
- the media associated to this input source.
All Packages Class Hierarchy This Package Previous Next Index