/**
     * 将指定的RecordSet转为Collection
     * @param rs 需要转的ResultSet对象
     * @return Collection类型的数据库集
     * @throws ParameterException 参数错误,传输的参数rs不合法
     * @throws SQLException 访问数据库异常
     */
    public static Collection resultSet2Collection(ResultSet rs) throws
            ParameterException, SQLException {
        Collection c = new Vector();
        if (rs == null) {
            throw new ParameterException(" parameter rs is null");
        }

        while (rs.next()) {
            HashMap hm = new HashMap();
            ResultSetMetaData rsmd = rs.getMetaData();
            int columnCount = rsmd.getColumnCount();
            for (int i = 1; i <= columnCount; i++) {
                hm.put(rsmd.getColumnName(i).toString(),
                        rs.getObject(i)==null?"":rs.getObject(i).toString().trim());
            }
            c.add(hm);
        }
        return c;
    }


    /**
     * 根据pagesize和position将指定的RecordSet转为Collection
     * @param rs 需要转的ResultSet对象
     * @param position 当前页数
     * @param pageSize 每页大小
     * @return Collection类型的数据库集
     * @throws ParameterException 参数错误,传输的参数rs不合法
     * @throws SQLException 访问数据库异常
     */
    public static Collection resultSet2Collection(ResultSet rs
                                                  , int position, int pageSize) throws
            ParameterException, SQLException {
        Collection c = new Vector();
        try{
        if (rs == null) {
            throw new ParameterException(" parameter rs is null");
        }
        if (position < 1) position = 1;

        if (pageSize <= 0) pageSize = DEFAULT_PAGESIZE;

        if (rs.absolute(position))
        do {
                HashMap hm = new HashMap();
                ResultSetMetaData rsmd = rs.getMetaData();
                int columnCount = rsmd.getColumnCount();
                for (int i = 1; i <= columnCount; i++) {
                    if (rsmd.getColumnTypeName(i).toLowerCase().equals("clob"))
                    {
                        String content = "";
                        CLOB clob = ((OracleResultSet) rs).getCLOB(rsmd.getColumnName(i));
                        if (clob != null) {
                            Reader reader = clob.getCharacterStream();
                            BufferedReader bufferedReader = new BufferedReader(
                                    reader);
                            String str = bufferedReader.readLine();
                            while (str != null) {
                                content += str + "\n";
                                str = bufferedReader.readLine();
                            }
                        }
                        hm.put(rsmd.getColumnName(i).toString(),content);
                    }
                    else{
                        hm.put(rsmd.getColumnName(i).toString(),
                               rs.getObject(i) == null ? "" :
                               rs.getObject(i).toString().trim());
                    }
                }
                c.add(hm);
                if (!rs.next())
                        break;
        } while (--pageSize > 0);
        }
        catch(IOException ioe){

        }
        return c;
    }