Coverage Report - org.jtheque.utils.ScannerUtils
 
Classes in this File Line Coverage Branch Coverage Complexity
ScannerUtils
0%
0/10
0%
0/6
5
 
 1  
 package org.jtheque.utils;
 2  
 
 3  
 import java.util.Scanner;
 4  
 
 5  
 /*
 6  
  * This file is part of JTheque.
 7  
  *
 8  
  * JTheque is free software: you can redistribute it and/or modify
 9  
  * it under the terms of the GNU General Public License as published by
 10  
  * the Free Software Foundation, either version 3 of the License.
 11  
  *
 12  
  * JTheque is distributed in the hope that it will be useful,
 13  
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 14  
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 15  
  * GNU General Public License for more details.
 16  
  *
 17  
  * You should have received a copy of the GNU General Public License
 18  
  * along with JTheque.  If not, see <http://www.gnu.org/licenses/>.
 19  
  */
 20  
 
 21  0
 public class ScannerUtils {
 22  
     public static String getLineStartingWith(Scanner scanner, String starts){
 23  0
         if(scanner != null){
 24  0
             while (scanner.hasNextLine()) {
 25  0
                 String line = scanner.nextLine().trim();
 26  
 
 27  0
                 if (line.startsWith(starts)) {
 28  0
                     scanner.close();
 29  
 
 30  0
                     return line;
 31  
                 }
 32  0
             }
 33  
 
 34  0
             scanner.close();
 35  
         }
 36  
 
 37  0
         return "";
 38  
     }
 39  
 }