@Override
    public Collection<DependencyInfo> parse(File dir) {
        BufferedReader br = null;
        FileReader fr = null;
        Collection<DependencyInfo> dependencyInfos = new LinkedList<>();
        if (dir.isDirectory()) {
            Collection<File> files = new LinkedList<>();
            getDescFiles(dir, files);
            if (!files.isEmpty()) {
                for (File file : files) {
                    try {
                        DependencyInfo dependencyInfo = null;
                        Package packageInfo = new Package();
                        fr = new FileReader(file);
                        br = new BufferedReader(fr);
                        String line = null;
                        // Create Arch Linux package - package-version-architecture.pkg.tar.xz
                        while ((line = br.readLine()) != null) {
                            switch (line) {
                                case PACKAGE:
                                    packageInfo.setPackageName(br.readLine());
                                    break;
                                case VERSION:
                                    packageInfo.setVersion(br.readLine());
                                    break;
                                case ARCHITECTURE:
                                    packageInfo.setArchitecture(br.readLine());
                                    break;
                                default:
                                    break;
                            }
                        }
                        dependencyInfos.add(createDependencyInfo(packageInfo));
                    } catch (FileNotFoundException e) {
                        logger.error("Error getting package data", e.getMessage());
                    } catch (IOException e) {
                        logger.error("Error getting package data", e.getMessage());
                    } finally {
                        closeStream(br, fr);
                    }
                }
            }
        }
        return dependencyInfos;
    }
@ Override public Collection < DependencyInfo > parse ( File dir ) { BufferedReader br = null ; FileReader fr = null ; Collection < DependencyInfo > dependencyInfos = new LinkedList < > ( ) ; if ( dir . isDirectory ( ) ) { Collection < File > files = new LinkedList < > ( ) ; getDescFiles ( dir , files ) ; if ( ! files . isEmpty ( ) ) { for ( File file : files ) { try { DependencyInfo dependencyInfo = null ; Package packageInfo = new Package ( ) ; fr = new FileReader ( file ) ; br = new BufferedReader ( fr ) ; String line = null ; while ( ( line = br . readLine ( ) ) != null ) { switch ( line ) { case PACKAGE : packageInfo . setPackageName ( br . readLine ( ) ) ; break ; case VERSION : packageInfo . setVersion ( br . readLine ( ) ) ; break ; case ARCHITECTURE : packageInfo . setArchitecture ( br . readLine ( ) ) ; break ; default : break ; } } dependencyInfos . add ( createDependencyInfo ( packageInfo ) ) ; } catch ( FileNotFoundException e ) { logger . error ( "Error getting package data" , e . getMessage ( ) ) ; } catch ( IOException e ) { logger . error ( "Error getting package data" , e . getMessage ( ) ) ; } finally { closeStream ( br , fr ) ; } } } } return dependencyInfos ; }
/* --- Overridden methods ---