The InputSource Class
The InputSource
class is an abstraction of a data source from which the raw bytes
of an XML document are read. It can wrap a system ID, a public ID,
an InputStream
, or a Reader
. When given an InputSource
, the parser tries to read
from the Reader
. If the
InputSource
does not have a
Reader
, the parser will try to
read from the InputStream
using
the specified encoding. If no encoding is specified, then it will
try to autodetect the encoding by reading the XML declaration.
Finally, if neither a Reader
nor an InputStream
has been
set, then the parser will open a connection to the URL given by
the system ID.
package org.xml.sax; public classInputSource
{ publicInputSource
( ); publicInputSource
(StringsystemID
); publicInputSource
(InputStreambyteStream
); publicInputSource
(Readerreader
); public voidsetPublicId
(StringpublicID
); public StringgetPublicId
( ); public voidsetSystemId
(StringsystemID
); public StringgetSystemId
( ); public voidsetByteStream
(InputStreambyteStream
); public InputStreamgetByteStream
( ); public voidsetEncoding
(Stringencoding
); public StringgetEncoding
( ); public voidsetCharacterStream
(Readerreader
); public ReadergetCharacterStrea
m
( ); }