public static String load ( final String cowfileSpec ) { String effectiveCowfileSpec = ( cowfileSpec != null ) ? cowfileSpec . trim ( ) : DEFAULT_COW ; if ( effectiveCowfileSpec . length ( ) > 0 ) { if ( ! effectiveCowfileSpec . endsWith ( COWFILE_EXT ) ) { effectiveCowfileSpec += COWFILE_EXT ; } InputStream cowInputStream ; if ( effectiveCowfileSpec . indexOf ( File . separatorChar ) >= 0 ) { cowInputStream = getCowFromPath ( effectiveCowfileSpec ) ; } else { cowInputStream = getCowFromCowPath ( effectiveCowfileSpec ) ; } if ( cowInputStream == null ) { // Maybe there should be a verbose mode where we log this sort of error instead of silently failing? cowInputStream = getCowFromResources ( DEFAULT_COW + COWFILE_EXT ) ; } if ( cowInputStream != null ) { String cow = cowInputStreamToString ( cowInputStream ) ; return cow ; } } return null ; // should never happen }
Call this with the provided cowfileSpec - that is the value passed to - f on the commandline .