001    package railo.runtime.query.caster;
002    
003    import java.io.IOException;
004    import java.io.InputStream;
005    import java.sql.ResultSet;
006    import java.sql.SQLException;
007    
008    import railo.commons.io.IOUtil;
009    
010    public class BlobCast implements Cast {
011    
012            public Object toCFType(int type, ResultSet rst, int columnIndex) throws SQLException, IOException {
013                    InputStream is = null;
014                    try{
015                            is = rst.getBinaryStream(columnIndex);
016                            if(is==null) return null;
017                            return IOUtil.toBytes(is);
018                    }
019                    finally {
020                            IOUtil.closeEL(is);
021                    }
022            }
023    
024    }