Java Scanner Usage processLine(String aLine)

Here you can find the source of processLine(String aLine)

Description

process Line

License

Open Source License

Declaration

protected static void processLine(String aLine) 

Method Source Code

//package com.java2s;
/*/*from w  w w.  java  2s.co  m*/
 * Copyright (C) 2005, 2006 
 * Santiago Carot Nemesio
 *
 * This file is part of NetGUI.
 *
 * NetGUI is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * NetGUI is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with NetGUI; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *  
 */

import java.util.Scanner;

public class Main {
    private static boolean ipv4AddrShow = true;
    private static boolean ipv6AddrShow = false;

    protected static void processLine(String aLine) {
        Scanner scanner = new Scanner(aLine);
        scanner.useDelimiter("=");
        if (scanner.hasNext()) {
            String name = (scanner.next()).trim();
            String value = (scanner.next()).trim();
            //       System.out.println("Variable=" + name.trim()); 
            //       System.out.println("Valor=" + value.trim()); 
            if (name.equals("IPv4AddrShow")) {
                if (value.equals("n"))
                    ipv4AddrShow = false;
            } else if (name.equals("IPv6AddrShow")) {
                if (value.equals("y"))
                    ipv6AddrShow = true;
            }
        }
        //        System.out.println("IPv4AddrShowBoolean=" + ipv4AddrShow + 
        //                           "     IPv6AddrShowBoolean=" + ipv6AddrShow ); 

    }
}

Related

  1. parseExperimentName(String name)
  2. parseQueryString(String queryString)
  3. parseTime(String input)
  4. pathTokenList(String path)
  5. pressEnterToContinue()
  6. queryMenu(Scanner in, String msg, LinkedList options)
  7. queryStr(Scanner in, String msg)
  8. removeFirstNLines(String text, int n)
  9. removeIndexes(String xpath)