Code example for StringReader

0
 
		assertEquals("complex mixed", "abc", filter("a\\\r\nb\\\n\\\n\\\r\nc")); 
	} 
 
	private static String filter(String s) throws IOException {
		ContinuationReader reader = new ContinuationReader(new StringReader(s));
		try { 
			StringBuilder buf = new StringBuilder();
			int c;
			while ((c = reader.read()) >= 0) {
				buf.append((char) c);
			} 
			return buf.toString();
		} finally { 
			reader.close();
		} 
	} 
}