public static String[] get_filelist(String path, boolean nodirs, boolean nofiles) { File folder = new File(path); if (folder.isDirectory()) { File[] listOfFiles = folder.listFiles(); java.util.Vector<String> r = new java.util.Vector<String>(); for (int i = 0; listOfFiles != null && i < listOfFiles.length; i++) { if ((listOfFiles[i].isFile() && !nofiles) || (listOfFiles[i].isDirectory() && !nodirs)) { r.add(listOfFiles[i].getName()); } } return r.toArray(new String[0]); } else { return null; // A: no existe o no es directorio } }
public static String[] dbRsColumnNames(ResultSet resultset) throws SQLException { java.util.Vector<String> rv = new java.util.Vector<String>(); if (resultset != null) { logm("DBG", 9, "ColumnCount=0 Calculando cantidad columnas desde metadata", null); ResultSetMetaData md = resultset.getMetaData(); int columnCount = md.getColumnCount(); logm("DBG", 9, "ColumnCount", columnCount); for (int i = 1; i <= columnCount; i++) { rv.add(md.getColumnName(i).toLowerCase()); } } String[] r = rv.toArray(new String[0]); logm("DBG", 9, "DB dbRsColumnNames", r); return r; }