Name

StreamSource

Synopsis

This class is a Source implementation that reads the textual format of an XML document from a file, byte stream, or character stream. Because XML documents declare their own encoding, it is preferable to create a StreamSource object from an InputStream instead of from a Reader, so that the XML processor can correctly handle the declared encoding. When creating a StreamSource from a byte stream or character stream, you should provide the “system id” (i.e. the filename or URL) by using one of the two-argument constructors or by caling setSystemId( ). The system id is required if the XML file to be processed includes relative URLs to be resolved.

javax.xml.transform.stream.StreamSource

Figure 20-17. javax.xml.transform.stream.StreamSource

public class StreamSource implements javax.xml.transform.Source {
// Public Constructors
     public StreamSource( );  
     public StreamSource(java.io.InputStream inputStream);  
     public StreamSource(java.io.Reader reader);  
     public StreamSource(java.io.File f);  
     public StreamSource(String systemId);  
     public StreamSource(java.io.Reader reader, String systemId);  
     public StreamSource(java.io.InputStream inputStream, String systemId);  
// Public Constants
     public static final String FEATURE; 
         ="http://javax.xml.transform.stream.StreamSource/feature" 
// Public Instance Methods
     public java.io.InputStream getInputStream( );                        default:null
     public String getPublicId( );                                        default:null public java.io.Reader ...

Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.