if (obj instanceof InputStream) {
return new InputStreamReader((InputStream)obj);
} else if (obj instanceof Reader) {
return (Reader)obj;
} else if (obj instanceof String) {
return new StringReader((String)obj);
}
throw new JspException("Invalid type '" + obj.getClass().getName() +
"' for castToReader()");