Java Scanner Usage getScannerContents(final Scanner scanner)

Here you can find the source of getScannerContents(final Scanner scanner)

Description

get Scanner Contents

License

Open Source License

Declaration

public static String getScannerContents(final Scanner scanner) throws IllegalArgumentException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Scanner;

public class Main {
    public static String getScannerContents(final Scanner scanner) throws IllegalArgumentException {
        String content;/*from   ww  w  .  ja va  2  s  .  co m*/
        if (scanner.hasNext()) { // will be false if file size == 0
            content = scanner.next();
        } else {
            content = "";
        }
        return content;
    }
}

Related

  1. getNextWord(String str, int index, StringBuilder outToken, String ignoreRegex)
  2. getNumberOfUsernames(String usernames)
  3. getOutputFromValgrindOutput(String valgrindOutput)
  4. getPartOfString(String string, int index, String delimiter)
  5. getReplay(String prompt)
  6. getStrings(Properties props, String key, String sep)
  7. getStrings(Scanner sc, int n)
  8. getTimeAsInt(String duration)
  9. getTypedValue(String question)