Package java.util

Examples of java.util.Scanner.nextLine()


                InputStream input = cur.openResource();
                try {
                    List<String> contents = Lists.create();
                    Scanner scanner = new Scanner(input, "UTF-8");
                    while (scanner.hasNextLine()) {
                        String line = scanner.nextLine();
                        contents.add(line);
                    }
                    entries.put(location.toPath('/'), contents);
                    scanner.close();
                } finally {
View Full Code Here


                InputStream input = cur.openResource();
                try {
                    List<String> contents = Lists.create();
                    Scanner scanner = new Scanner(input, "UTF-8");
                    while (scanner.hasNextLine()) {
                        String line = scanner.nextLine();
                        contents.add(line);
                    }
                    entries.put(location.toPath('/'), contents);
                    scanner.close();
                } finally {
View Full Code Here

        final Scanner scanner = new Scanner(stream, "UTF-8");
        return new DataModelReader<Line>() {
            @Override
            public boolean readTo(Line object) throws IOException {
                if (scanner.hasNextLine()) {
                    object.getValueOption().modify(scanner.nextLine());
                    return true;
                }
                return false;
            }
        };
View Full Code Here

    private void test(File file, String... lines) throws IOException {
        List<String> actual = new ArrayList<String>();
        Scanner scanner = new Scanner(file, "UTF-8");
        try {
            while (scanner.hasNextLine()) {
                actual.add(scanner.nextLine());
            }
        } finally {
            scanner.close();
        }
        assertThat(actual, is(Arrays.asList(lines)));
View Full Code Here

        return new DataModelReader<StringBuilder>() {
            @Override
            public boolean readTo(StringBuilder object) throws IOException {
                if (scanner.hasNextLine()) {
                    object.setLength(0);
                    object.append(scanner.nextLine());
                    return true;
                }
                return false;
            }
        };
View Full Code Here

    private List<String> scan(byte[] bytes) {
        Scanner scanner = new Scanner(new ByteArrayInputStream(bytes), DEFAULT_ENCODING.name());
        try {
            List<String> results = Lists.create();
            while (scanner.hasNextLine()) {
                results.add(scanner.nextLine());
            }
            return results;
        } finally {
            scanner.close();
        }
View Full Code Here

        for (Path path : find(target)) {
            InputStream input = fs.open(path);
            try {
                Scanner s = new Scanner(new InputStreamReader(input, "UTF-8"));
                while (s.hasNextLine()) {
                    results.add(s.nextLine());
                }
                s.close();
            } finally {
                input.close();
            }
View Full Code Here

        Process process = builder.start();
        try {
            InputStream stream = process.getInputStream();
            Scanner scanner = new Scanner(stream);
            while (scanner.hasNextLine()) {
                logger.info(scanner.nextLine());
            }
            scanner.close();
            return process.waitFor();
        } catch (InterruptedException e) {
            throw new IOException(e);
View Full Code Here

        return new ModelInput<Line>() {
            int position = 0;
            @Override
            public boolean readTo(Line model) throws IOException {
                if (scanner.hasNextLine()) {
                    String line = scanner.nextLine();
                    model.setValueAsString(line);
                    model.setFirstAsString(line.isEmpty() ? "" : line.substring(0, 1));
                    model.setLength(line.length());
                    model.setPosition(position);
                    position++;
View Full Code Here

    private List<String> get(File target) throws FileNotFoundException {
        Scanner s = new Scanner(target, "UTF-8");
        try {
            List<String> results = new ArrayList<String>();
            while (s.hasNextLine()) {
                results.add(s.nextLine());
            }
            return results;
        } finally {
            s.close();
        }
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.