- public static BufferedReader createReader( final Object source ) throws IOException, FileNotFoundException {
- BufferedReader reader = null;
- if ( ( source instanceof File ) || ( source instanceof String ) ) {
- File f = null;
- if ( source instanceof File ) {
- f = ( File ) source;
- }
- else {
- f = new File( ( String ) source );
- }
- if ( !f.exists() ) {
- throw new IOException( "[" + f.getAbsolutePath() + "] does not exist" );
- }
- else if ( !f.isFile() ) {
- throw new IOException( "[" + f.getAbsolutePath() + "] is not a file" );
- }
- else if ( !f.canRead() ) {
- throw new IOException( "[" + f.getAbsolutePath() + "] is not a readable" );
- }
- reader = new BufferedReader( new FileReader( f ) );
- }
- else if ( source instanceof InputStream ) {
- reader = new BufferedReader( new InputStreamReader( ( InputStream ) source ) );
- }
- else if ( ( source instanceof StringBuffer ) || ( source instanceof StringBuilder ) ) {
- reader = new BufferedReader( new StringReader( source.toString() ) );
- }
- else {
- throw new IllegalArgumentException( "attempt to parse object of type [" + source.getClass()
- + "] (can only parse objects of type File/String, InputStream, StringBuffer, or StringBuilder)" );
- }
- return reader;
+ public final static Phylogeny[] readPhylogenies( final File file ) throws FileNotFoundException, IOException {
+ return PhylogenyMethods.readPhylogenies( ParserUtils.createParserDependingOnFileType( file, true ), file );
+ }
+
+ public final static Phylogeny[] readPhylogenies( final String file_name ) throws FileNotFoundException, IOException {
+ return readPhylogenies( new File( file_name ) );