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    import java.util.TimeZone;
008    
009    import railo.commons.io.IOUtil;
010    
011    public class BlobCast implements Cast {
012    
013            public Object toCFType(TimeZone tz, int type, ResultSet rst, int columnIndex) throws SQLException, IOException {
014                    InputStream is = null;
015                    try{
016                            is = rst.getBinaryStream(columnIndex);
017                            if(is==null) return null;
018                            return IOUtil.toBytes(is);
019                    }
020                    finally {
021                            IOUtil.closeEL(is);
022                    }
023            }
024    
025    }