public static String[] listAllCowfiles() {
		String[] resultAsArray;
		String[] bundled = null;
		String cowfileExtRe = "\\" + COWFILE_EXT + "$";
		InputStream bundleStream = Cowloader.class.getResourceAsStream("/cowfile-list.csv");
		if (bundleStream != null) {
			BufferedReader reader = new BufferedReader(new InputStreamReader(bundleStream));
			StringBuilder sb = new StringBuilder();
			try {
				String line;
				while ((line = reader.readLine()) != null) {
					sb.append(line);
				}
				reader.close();
				String bundleList = sb.toString();
				bundled = bundleList.split(",");
			} catch (IOException ex) {
				Logger.getLogger(Cowloader.class.getName()).log(Level.WARNING, null, ex);
			} finally {
				try {
					bundleStream.close();
				} catch (IOException ex) {
					Logger.getLogger(Cowloader.class.getName()).log(Level.SEVERE, null, ex);
				}
			}
		}

		Set<String> result = new HashSet<String>();
		if (bundled != null) {
			for (String cowfile : bundled) {
				if (cowfile.endsWith(COWFILE_EXT)) {  // mech-and-cow for example is not a cowfile and should be excluded
					result.add(cowfile.replaceAll(cowfileExtRe, ""));
				}
			}
		}
		String cowPath = System.getenv("COWPATH");
		if (cowPath != null) {
			String[] paths = cowPath.split(File.pathSeparator);
			if (paths != null) {
				for (String path : paths) {
					File[] cowfiles = getCowFiles(path);
					if (cowfiles != null) {
						for (File cowfile : cowfiles) {
							result.add(cowfile.getName().replaceAll(cowfileExtRe, ""));
						}
					}
				}
			}
		}
		resultAsArray = result.toArray(new String[result.size()]);
		Arrays.sort(resultAsArray);
		return resultAsArray;

	}
public static String[] listAllCowfiles() {
		String[] resultAsArray;
		String[] bundled = null;
		String cowfileExtRe = "\\" + COWFILE_EXT + "$";
		InputStream bundleStream = Cowloader.class.getResourceAsStream("/cowfile-list.csv");
		if (bundleStream != null) {
			BufferedReader reader = new BufferedReader(new InputStreamReader(bundleStream));
			StringBuilder sb = new StringBuilder();
			try {
				String line;
				while ((line = reader.readLine()) != null) {
					sb.append(line);
				}
				reader.close();
				String bundleList = sb.toString();
				bundled = bundleList.split(",");
			} catch (IOException ex) {
				Logger.getLogger(Cowloader.class.getName()).log(Level.WARNING, null, ex);
			} finally {
				try {
					bundleStream.close();
				} catch (IOException ex) {
					Logger.getLogger(Cowloader.class.getName()).log(Level.SEVERE, null, ex);
				}
			}
		}

		Set<String> result = new HashSet<String>();
		if (bundled != null) {
			for (String cowfile : bundled) {
				if (cowfile.endsWith(COWFILE_EXT)) {  
					result.add(cowfile.replaceAll(cowfileExtRe, ""));
				}
			}
		}
		String cowPath = System.getenv("COWPATH");
		if (cowPath != null) {
			String[] paths = cowPath.split(File.pathSeparator);
			if (paths != null) {
				for (String path : paths) {
					File[] cowfiles = getCowFiles(path);
					if (cowfiles != null) {
						for (File cowfile : cowfiles) {
							result.add(cowfile.getName().replaceAll(cowfileExtRe, ""));
						}
					}
				}
			}
		}
		resultAsArray = result.toArray(new String[result.size()]);
		Arrays.sort(resultAsArray);
		return resultAsArray;

	}
public static String [ ] listAllCowfiles ( ) { String [ ] resultAsArray ; String [ ] bundled = null ; String cowfileExtRe = "\\" + COWFILE_EXT + "$" ; InputStream bundleStream = Cowloader . class . getResourceAsStream ( "/cowfile-list.csv" ) ; if ( bundleStream != null ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( bundleStream ) ) ; StringBuilder sb = new StringBuilder ( ) ; try { String line ; while ( ( line = reader . readLine ( ) ) != null ) { sb . append ( line ) ; } reader . close ( ) ; String bundleList = sb . toString ( ) ; bundled = bundleList . split ( "," ) ; } catch ( IOException ex ) { Logger . getLogger ( Cowloader . class . getName ( ) ) . log ( Level . WARNING , null , ex ) ; } finally { try { bundleStream . close ( ) ; } catch ( IOException ex ) { Logger . getLogger ( Cowloader . class . getName ( ) ) . log ( Level . SEVERE , null , ex ) ; } } } Set < String > result = new HashSet < String > ( ) ; if ( bundled != null ) { for ( String cowfile : bundled ) { if ( cowfile . endsWith ( COWFILE_EXT ) ) { // mech-and-cow for example is not a cowfile and should be excluded result . add ( cowfile . replaceAll ( cowfileExtRe , "" ) ) ; } } } String cowPath = System . getenv ( "COWPATH" ) ; if ( cowPath != null ) { String [ ] paths = cowPath . split ( File . pathSeparator ) ; if ( paths != null ) { for ( String path : paths ) { File [ ] cowfiles = getCowFiles ( path ) ; if ( cowfiles != null ) { for ( File cowfile : cowfiles ) { result . add ( cowfile . getName ( ) . replaceAll ( cowfileExtRe , "" ) ) ; } } } } } resultAsArray = result . toArray ( new String [ result . size ( ) ] ) ; Arrays . sort ( resultAsArray ) ; return resultAsArray ; }
List the names of all cowfiles found when searching COWPATH (including bundled cowfiles).
Primarily useful for the "-l" commandline flag and also handy for unit testing.
@return The names of available cowfiles.
List the names of all cowfiles found when searching COWPATH ( including bundled cowfiles ) . Primarily useful for the - l commandline flag and also handy for unit testing .