public static Clob toClob ( Object value ) throws PageException { if ( value instanceof Clob ) return ( Clob ) value ; else if ( value instanceof char [ ] ) return toClob ( new String ( ( char [ ] ) value ) ) ; else if ( value instanceof Reader ) { StringWriter sw = new StringWriter ( ) ; try { IOUtil . copy ( ( Reader ) value , sw , false , true ) ; } catch ( IOException e ) { throw ExpressionException . newInstance ( e ) ; } return toClob ( sw . toString ( ) ) ; } return toClob ( Caster . toString ( value ) ) ; }
cast given value to a clob