src/main/java/org/tinyradius/dictionary/DictionaryParser.java
public static void parseDictionary(InputStream source, WritableDictionary dictionary)
        throws IOException {
        // read each line separately
        BufferedReader in = new BufferedReader(new InputStreamReader(source));

        String line;
        int lineNum = -1;
        while ((line = in.readLine()) != null) {
            // ignore comments
            lineNum++;
            line = line.trim();
            if (line.startsWith("#") || line.length() == 0) {
                continue;
            }

            // tokenize line by whitespace
            StringTokenizer tok = new StringTokenizer(line);
            if (!tok.hasMoreTokens()) {
                continue;
            }

            String lineType = tok.nextToken().trim();
            if (lineType.equalsIgnoreCase("ATTRIBUTE")) {
                parseAttributeLine(dictionary, tok, lineNum);
            }
            else if (lineType.equalsIgnoreCase("VALUE")) {
                parseValueLine(dictionary, tok, lineNum);
            }
            else if (lineType.equalsIgnoreCase("$INCLUDE")) {
                includeDictionaryFile(dictionary, tok, lineNum);
            }
            else if (lineType.equalsIgnoreCase("VENDORATTR")) {
                parseVendorAttributeLine(dictionary, tok, lineNum);
            }
            else if (lineType.equals("VENDOR")) {
                parseVendorLine(dictionary, tok, lineNum);
            }
            else {
                throw new IOException("unknown line type: " + lineType + " line: " + lineNum);
            }
        }
    }
/**
     * Parses the dictionary from the specified InputStream.
     *
     * @param source     input stream
     * @param dictionary dictionary data is written to
     * @throws IOException      syntax errors
     * @throws RuntimeException syntax errors
     */
Parses the dictionary from the specified InputStream.

@param source     input stream
@param dictionary dictionary data is written to
@throws IOException      syntax errors
@throws RuntimeException syntax errors
Parses the dictionary from the specified InputStream . @param source input stream @param dictionary dictionary data is written to @throws IOException syntax errors @throws RuntimeException syntax errors
public static void parseDictionary(InputStream source, WritableDictionary dictionary)
        throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(source));
        String line;
        int lineNum = -1;
        while ((line = in.readLine()) != null) {
            lineNum++;
            line = line.trim();
            if (line.startsWith("#") || line.length() == 0) {
                continue;
            }
            StringTokenizer tok = new StringTokenizer(line);
            if (!tok.hasMoreTokens()) {
                continue;
            }
            String lineType = tok.nextToken().trim();
            if (lineType.equalsIgnoreCase("ATTRIBUTE")) {
                parseAttributeLine(dictionary, tok, lineNum);
            }
            else if (lineType.equalsIgnoreCase("VALUE")) {
                parseValueLine(dictionary, tok, lineNum);
            }
            else if (lineType.equalsIgnoreCase("$INCLUDE")) {
                includeDictionaryFile(dictionary, tok, lineNum);
            }
            else if (lineType.equalsIgnoreCase("VENDORATTR")) {
                parseVendorAttributeLine(dictionary, tok, lineNum);
            }
            else if (lineType.equals("VENDOR")) {
                parseVendorLine(dictionary, tok, lineNum);
            }
            else {
                throw new IOException("unknown line type: " + lineType + " line: " + lineNum);
            }
        }
    }
public static void parseDictionary ( InputStream source , WritableDictionary dictionary ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( source ) ) ; String line ; int lineNum = - 1 ; while ( ( line = in . readLine ( ) ) != null ) { lineNum ++ ; line = line . trim ( ) ; if ( line . startsWith ( "#" ) || line . length ( ) == 0 ) { continue ; } StringTokenizer tok = new StringTokenizer ( line ) ; if ( ! tok . hasMoreTokens ( ) ) { continue ; } String lineType = tok . nextToken ( ) . trim ( ) ; if ( lineType . equalsIgnoreCase ( "ATTRIBUTE" ) ) { parseAttributeLine ( dictionary , tok , lineNum ) ; } else if ( lineType . equalsIgnoreCase ( "VALUE" ) ) { parseValueLine ( dictionary , tok , lineNum ) ; } else if ( lineType . equalsIgnoreCase ( "$INCLUDE" ) ) { includeDictionaryFile ( dictionary , tok , lineNum ) ; } else if ( lineType . equalsIgnoreCase ( "VENDORATTR" ) ) { parseVendorAttributeLine ( dictionary , tok , lineNum ) ; } else if ( lineType . equals ( "VENDOR" ) ) { parseVendorLine ( dictionary , tok , lineNum ) ; } else { throw new IOException ( "unknown line type: " + lineType + " line: " + lineNum ) ; } } }
Parses the dictionary from the specified InputStream.
Parses the dictionary from the specified InputStream .
// read each line separately
 // ignore comments
 // tokenize line by whitespace
