Code example for InputSource

Methods: setEncoding

0
     * handler. 
     */ 
    private static void parse(InputStream in, Encoding encoding,
            ContentHandler contentHandler) throws IOException, SAXException {
        try { 
            XMLReader reader = new ExpatReader();
            reader.setContentHandler(contentHandler);
            InputSource source = new InputSource(in);
            source.setEncoding(encoding.expatName);
            reader.parse(source);
        } catch (IOException e) {
            throw new AssertionError(e);
        } 
    } 
 
    /** 
     * Supported character encodings. 
     */ 
    private enum Encoding { 
 
        US_ASCII("US-ASCII"),