Code example for CharArrayReader

        if (header != null && header.length() > 10) {
            // Prepare a reader based on our input header string 
            int length = header.length();
            char c[] = new char[length];
            header.getChars(0, length, c, 0);
            Reader reader = new CharArrayReader(c);
            try { 
                // Get a SAXParser from the SAXPArserFactory 
                SAXParserFactory spf = SAXParserFactory.newInstance();
                SAXParser sp = spf.newSAXParser();
                // Get the XMLReader of the SAXParser we created 
                XMLReader xr = sp.getXMLReader();
                // Create a new ContentHandler and apply it to the 
                // XML-Reader 
                XmlHandler dataHandler = new XmlHandler();
                // Parse the xml-data from our URL (ie Uri) 
Contextual code suggestions in your IDE  Get Codota for Java