Package java.util

Examples of java.util.Scanner.nextLine()


        Scanner s1 = new Scanner(rp.open());
        closeables.add(s1);

        assertThat(s1.hasNextLine(), is(true));
        assertThat(s1.nextLine(), is("Hello, world!"));

        assertThat(s1.hasNextLine(), is(false));

        Scanner s2 = new Scanner(rp.open());
        closeables.add(s2);
View Full Code Here


        Scanner s2 = new Scanner(rp.open());
        closeables.add(s2);

        assertThat(s2.hasNextLine(), is(true));
        assertThat(s2.nextLine(), is("Hello, world!"));

        assertThat(s2.hasNextLine(), is(false));
    }
}
View Full Code Here

            return new ModelInput<StringBuilder>() {
                @Override
                public boolean readTo(StringBuilder model) throws IOException {
                    if (s.hasNextLine()) {
                        model.delete(0, model.length());
                        model.append(s.nextLine());
                        return true;
                    }
                    return false;
                }
                @Override
View Full Code Here

    private static List<String> loadLines(String path) throws IOException {
        Scanner scanner = new Scanner(new File(path), "UTF-8");
        try {
            List<String> result = new ArrayList<String>();
            while (scanner.hasNextLine()) {
                result.add(scanner.nextLine());
            }
            return result;
        } finally {
            scanner.close();
        }
View Full Code Here

            scanner = new Scanner(new File(ssInFile), "UTF-8");
            String currentLine = "";
            String prevLine = "";
            while (scanner.hasNextLine()) {
                prevLine = currentLine;
                currentLine = scanner.nextLine();

                String trimmedPrevLine = prevLine.trim();
                String trimmedCurrentLine = currentLine.trim();

                // First time processing - replace view="<file>.svg" with _view_file="<file>.svg" + view="<svg_xml>"
View Full Code Here

        StringBuilder fileContents = new StringBuilder();
        Scanner scanner = new Scanner(new File(pathname), "UTF-8");
        String lineSeparator = System.getProperty("line.separator");
        try {
            while (scanner.hasNextLine()) {
                fileContents.append(scanner.nextLine() + lineSeparator);
            }
            return fileContents.toString();
        } finally {
            scanner.close();
        }
View Full Code Here

        Scanner scanner = null;
        Writer out = null;
        try {
            scanner = new Scanner(new FileInputStream("../main_config.ini"), "UTF-8");
            while (scanner.hasNextLine()) {
                text.append(scanner.nextLine()).append(NL);
            }
            out = new OutputStreamWriter(
                    new FileOutputStream("../main_config.ini"), "UTF-8");
            out.write(text.toString().replace("\\", "/"));
        } catch (Exception ex) {
View Full Code Here

    System.out.println("Please enter the google password for:"
        + GOOGLE_USERNAME
        + " (or edit DocumentListTest.java to use your own username)");
    Scanner scanner = new Scanner(System.in);
    String password = scanner.nextLine();

    demo = new GoogleDocumentList(APPLICATION_NAME, GOOGLE_HOST);
    demo.login(GOOGLE_USERNAME, password);

    //turnOnLogging();
View Full Code Here

        Scanner scanner = null;
        Writer out = null;
        try {
            scanner = new Scanner(new FileInputStream(destinationFolder + "main_config.ini"), "UTF-8");
            while (scanner.hasNextLine()) {
                stringTmpLine = scanner.nextLine();
                if (stringTmpLine.contains("Mater_Lector")) {
                    stringTmpLine = "Mater_Lector=" + MainFrame.MaterLectorPath.getText() + "/";
                }
                if (stringTmpLine.contains("Lector_Repository")) {
                    stringTmpLine = "Lector_Repository=" + MainFrame.LectorRepositoryPath.getText() + "/";
View Full Code Here

            Scanner scanner = null;
            String tmpStr = "";
            try {
                scanner = new Scanner(new FileInputStream(LectorUnInstallerApp.shortcutsListContainer), "CP1251");
                while (scanner.hasNextLine()) {
                    tmpStr = scanner.nextLine();
                    JOptionPane.showMessageDialog(null, tmpStr, "LectorInstaller", 1);
                    System.out.println((new File(tmpStr)).delete());
                }

            } catch (Exception ex) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.