Code example for ByteArrayInputStream

Methods: close

0
	 
	public void parse(String simplePresenceXml) throws Exception {
		SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
		SAXParser        saxParser        = saxParserFactory.newSAXParser();
		 
		ByteArrayInputStream bais = new ByteArrayInputStream(simplePresenceXml.getBytes());
		 
		saxParser.parse(bais, new SimplePresenceParser());
		bais.close();
	} 
	 
	 
	public static SimplePresence parseSimplePresence(String simplePresenceXml) throws Exception {
		SimplePresence simplePresenceObject = new SimplePresence();
		simplePresenceObject.parse(simplePresenceXml);
		 
		return simplePresenceObject;
	} 
	 
	class SimplePresenceParser extends DefaultHandler {
//		private boolean isStartTag   = false;