src/org/openstreetmap/josm/plugins/opendata/core/modules/ModuleListParser.java
public List<ModuleInformation> parse(InputStream in) throws ModuleListParseException {
        List<ModuleInformation> ret = new LinkedList<>();
        BufferedReader r = null;
        try {
            r = new BufferedReader(new InputStreamReader(in, "utf-8"));
            String name = null;
            String url = null;
            StringBuilder manifest = new StringBuilder();
            /*
            code structure:
                for () {
                    A;
                    B;
                    C;
                }
                B;
             */
            for (String line = r.readLine(); line != null; line = r.readLine()) {
                if (line.startsWith("\t")) {
                    line = line.substring(1);
                    if (line.length() > 70) {
                        manifest.append(line.substring(0, 70)).append("\n");
                        line = " " + line.substring(70);
                    }
                    manifest.append(line).append("\n");
                    continue;
                }
                if (name != null) {
                    ModuleInformation info = createInfo(name, url, manifest.toString());
                    if (info != null) {
                        for (Module module : ModuleHandler.moduleList) {
                            if (module.getModuleInformation().name.equals(info.getName())) {
                                info.localversion = module.getModuleInformation().localversion;
                            }
                        }
                        ret.add(info);
                    }
                }
                String[] x = line.split(";");
                if (x.length != 2)
                    throw new IOException(tr("Illegal entry in module list."));
                name = x[0];
                url = x[1];
                manifest = new StringBuilder();
            }
            if (name != null) {
                ModuleInformation info = createInfo(name, url, manifest.toString());
                for (Module module : ModuleHandler.moduleList) {
                    if (module.getModuleInformation().name.equals(info.getName())) {
                        info.localversion = module.getModuleInformation().localversion;
                    }
                }
                ret.add(info);
            }
            return ret;
        } catch (IOException e) {
            throw new ModuleListParseException(e);
        }
    }
/**
     * Parses a module information document and replies a list of module information objects.
     *
     * See <a href="https://svn.openstreetmap.org/applications/editors/josm/plugins/opendata/modules.txt">OSM SVN</a>
     * for a sample of the document. The format is a custom format, kind of mix of CSV and RFC822 style
     * name/value-pairs.
     *
     * @param in the input stream from which to parse
     * @return the list of module information objects
     * @throws ModuleListParseException thrown if something goes wrong while parsing
     */
Parses a module information document and replies a list of module information objects.

See OSM SVN
for a sample of the document. The format is a custom format, kind of mix of CSV and RFC822 style
name/value-pairs.

@param in the input stream from which to parse
@return the list of module information objects
@throws ModuleListParseException thrown if something goes wrong while parsing
Parses a module information document and replies a list of module information objects . See OSM SVN for a sample of the document . The format is a custom format kind of mix of CSV and RFC822 style name / value - pairs . @param in the input stream from which to parse @return the list of module information objects @throws ModuleListParseException thrown if something goes wrong while parsing
public List<ModuleInformation> parse(InputStream in) throws ModuleListParseException {
        List<ModuleInformation> ret = new LinkedList<>();
        BufferedReader r = null;
        try {
            r = new BufferedReader(new InputStreamReader(in, "utf-8"));
            String name = null;
            String url = null;
            StringBuilder manifest = new StringBuilder();
            /*
            code structure:
                for () {
                    A;
                    B;
                    C;
                }
                B;
             */
            for (String line = r.readLine(); line != null; line = r.readLine()) {
                if (line.startsWith("\t")) {
                    line = line.substring(1);
                    if (line.length() > 70) {
                        manifest.append(line.substring(0, 70)).append("\n");
                        line = " " + line.substring(70);
                    }
                    manifest.append(line).append("\n");
                    continue;
                }
                if (name != null) {
                    ModuleInformation info = createInfo(name, url, manifest.toString());
                    if (info != null) {
                        for (Module module : ModuleHandler.moduleList) {
                            if (module.getModuleInformation().name.equals(info.getName())) {
                                info.localversion = module.getModuleInformation().localversion;
                            }
                        }
                        ret.add(info);
                    }
                }
                String[] x = line.split(";");
                if (x.length != 2)
                    throw new IOException(tr("Illegal entry in module list."));
                name = x[0];
                url = x[1];
                manifest = new StringBuilder();
            }
            if (name != null) {
                ModuleInformation info = createInfo(name, url, manifest.toString());
                for (Module module : ModuleHandler.moduleList) {
                    if (module.getModuleInformation().name.equals(info.getName())) {
                        info.localversion = module.getModuleInformation().localversion;
                    }
                }
                ret.add(info);
            }
            return ret;
        } catch (IOException e) {
            throw new ModuleListParseException(e);
        }
    }
public List < ModuleInformation > parse ( InputStream in ) throws ModuleListParseException { List < ModuleInformation > ret = new LinkedList < > ( ) ; BufferedReader r = null ; try { r = new BufferedReader ( new InputStreamReader ( in , "utf-8" ) ) ; String name = null ; String url = null ; StringBuilder manifest = new StringBuilder ( ) ; /*
            code structure:
                for () {
                    A;
                    B;
                    C;
                }
                B;
             */ for ( String line = r . readLine ( ) ; line != null ; line = r . readLine ( ) ) { if ( line . startsWith ( "\t" ) ) { line = line . substring ( 1 ) ; if ( line . length ( ) > 70 ) { manifest . append ( line . substring ( 0 , 70 ) ) . append ( "\n" ) ; line = " " + line . substring ( 70 ) ; } manifest . append ( line ) . append ( "\n" ) ; continue ; } if ( name != null ) { ModuleInformation info = createInfo ( name , url , manifest . toString ( ) ) ; if ( info != null ) { for ( Module module : ModuleHandler . moduleList ) { if ( module . getModuleInformation ( ) . name . equals ( info . getName ( ) ) ) { info . localversion = module . getModuleInformation ( ) . localversion ; } } ret . add ( info ) ; } } String [ ] x = line . split ( ";" ) ; if ( x . length != 2 ) throw new IOException ( tr ( "Illegal entry in module list." ) ) ; name = x [ 0 ] ; url = x [ 1 ] ; manifest = new StringBuilder ( ) ; } if ( name != null ) { ModuleInformation info = createInfo ( name , url , manifest . toString ( ) ) ; for ( Module module : ModuleHandler . moduleList ) { if ( module . getModuleInformation ( ) . name . equals ( info . getName ( ) ) ) { info . localversion = module . getModuleInformation ( ) . localversion ; } } ret . add ( info ) ; } return ret ; } catch ( IOException e ) { throw new ModuleListParseException ( e ) ; } }
Parses a module information document and replies a list of module information objects.
Parses a module information document and replies a list of module information objects .