Package com.google.common.io

Examples of com.google.common.io.LineReader.readLine()


    final FileReader fileReader = new FileReader(new File(INPUT_FILE));
    final LineReader reader = new LineReader(fileReader);
    try {
      JsonNode obj;
      String line;
      while ((line = reader.readLine()) != null) {
        obj = mapper.readTree(line);
        this.convertRatedOutputCurrent(obj);
        this.convertRatedOutputVoltage(obj);
        this.convertRatedOutputkW(obj);
        this.convertLatitude(obj);
View Full Code Here


    logger.info("Loading JSON objects from {}", input);
    final LineReader reader = new LineReader(new FileReader(input));

    int counter = 0;
    String line;
    while ((line = reader.readLine()) != null) {
      server.add(this.parseObject(line));
      counter++;
    }
    server.commit();
    logger.info("Loaded {} JSON objects", counter);
View Full Code Here

      PrintWriter writer = new PrintWriter(new OutputStreamWriter(socket.getOutputStream(), Charsets.UTF_8), true);
      LineReader reader = new LineReader(new InputStreamReader(socket.getInputStream(), Charsets.UTF_8));

      String msg = "Local file test";
      writer.println(msg);
      Assert.assertEquals(header, reader.readLine());
      Assert.assertEquals(msg, reader.readLine());
    } finally {
      socket.close();
    }
View Full Code Here

      LineReader reader = new LineReader(new InputStreamReader(socket.getInputStream(), Charsets.UTF_8));

      String msg = "Local file test";
      writer.println(msg);
      Assert.assertEquals(header, reader.readLine());
      Assert.assertEquals(msg, reader.readLine());
    } finally {
      socket.close();
    }

    controller.stopAndWait();
View Full Code Here

      try {
        PrintWriter writer = new PrintWriter(new OutputStreamWriter(socket.getOutputStream(), Charsets.UTF_8), true);
        LineReader reader = new LineReader(new InputStreamReader(socket.getInputStream(), Charsets.UTF_8));

        writer.println(msg);
        Assert.assertEquals(msg, reader.readLine());
      } finally {
        socket.close();
      }
    }
View Full Code Here

    int nameIndex = 0;
    int positionalIndex = 0;
    int position = 0;
    boolean first = true;
   
    while ( (line = lr.readLine()) != null) {
      if (first) first = false;
      else sb.append("\n");
      Matcher m = tokenPattern.matcher(line);
      if (m.matches()) {
        String leftHand = m.group(1);
View Full Code Here

    @Override public Void call() throws IOException, InterruptedException, ParseException {
      LineReader lineReader = new LineReader(reader);
      boolean threw = true;
      try {
        String line;
        while ((line = lineReader.readLine()) != null) {
          LogMessage logMessage = logMessageParser.parse(line);
          if (options.verbose() && !(logMessage instanceof CaliperControlLogMessage)) {
            stdout.printf("[trial-%d] %s%n", trialNumber, line);
          }
          outputQueue.put(new StreamItem(logMessage));
View Full Code Here

    int referenceStartIndex = 0;
    int lineIndex = 0;
   
    String PE = "For path: '{}', ";
   
    while ( (line = lr.readLine()) != null) {
      if (first) first = false;
      Matcher m = tokenPattern.matcher(line);
      String tag;
      if (m.matches() && (tag = m.group(1)) != null && ! (tag = tag.trim()).isEmpty()) {
        if (tag != null && tag.startsWith("#")) {
View Full Code Here

                new StringReader(xmlDocument.prettyPrint()));

        StringBuilder actualMappings = new StringBuilder();
        String line;
        int count = 1;
        while ((line = lineReader.readLine()) != null) {
            actualMappings.append(count).append(line).append("\n");
            if (resultingSourceMapping.containsKey(count)) {
                for (Record record : resultingSourceMapping.get(count)) {
                    actualMappings.append(count).append("-->")
                            .append(record.getActionLocation().toString())
View Full Code Here

        LineReader reader = new LineReader(new InputStreamReader(socket.getInputStream(), Charsets.UTF_8));

        String msg = "Failure";
        writer.println(msg);

        String line = reader.readLine();
        Assert.assertTrue(line.endsWith(msg));
        instances.add(Integer.parseInt(line.substring(0, line.length() - msg.length())));
      } finally {
        socket.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.