Package com.manning.hip.ch3

Examples of com.manning.hip.ch3.TextArrayWritable


      byte[] value = result.getValue(
          STOCK_DETAILS_COLUMN_FAMILY_AS_BYTES,
          STOCK_COLUMN_QUALIFIER_AS_BYTES);

      Stock stock = reader.decode(value);

      System.out.println("rowkey = '" + rowkey +
          "' stock = '" +
          ToStringBuilder
              .reflectionToString(stock, ToStringStyle.SIMPLE_STYLE));
View Full Code Here


  static CSVParser parser = new CSVParser();

  public static Stock createStock(String line) throws IOException {

    String parts[] = parser.parseLine(line);
    Stock stock = new Stock();

    stock.setSymbol(parts[0]);
    stock.setDate(parts[1]);
    stock.setOpen(Double.valueOf(parts[2]));
    stock.setHigh(Double.valueOf(parts[3]));
    stock.setLow(Double.valueOf(parts[4]));
    stock.setClose(Double.valueOf(parts[5]));
    stock.setVolume(Integer.valueOf(parts[6]));
    stock.setAdjClose(Double.valueOf(parts[7]));

    return stock;
  }
View Full Code Here

      double count = 0;
      while (values.hasNext()) {
        total += values.next().get();
        count++;
      }
      StockAvg avg = new StockAvg();
      avg.setSymbol(key.toString());
      avg.setAvg(total / count);
      output.collect(new AvroWrapper<StockAvg>(avg),
          NullWritable.get());
    }
View Full Code Here

    this.adjClose = adjClose;
  }

  public static StockPriceWritable fromLine(String line)
      throws IOException {
    CSVParser parser = new CSVParser();
    String[] parts = parser.parseLine(line);

    StockPriceWritable stock = new StockPriceWritable(
        //<co id="ch03_comment_seqfile_write3"/>
        parts[0], parts[1], Double.valueOf(parts[2]),
        Double.valueOf(parts[3]),
View Full Code Here

    private void parseLine() {
      String line = reader.getCurrentValue().toString();
      String[] tokens =
          StringUtils.splitPreserveAllTokens(line,
              PASSWD_LINE_SEPARATOR);
      value = new Passwd(
          StringUtils.trimToNull(tokens[0]),
          StringUtils.trimToNull(tokens[1]),
          StringUtils.trimToNull(tokens[2]) == null ?
              null : Long.valueOf(tokens[2]),
          StringUtils.trimToNull(tokens[3]) == null ?
View Full Code Here

    ProtobufBlockReader<Stock> reader =
        new ProtobufBlockReader<Stock>(
            inputStream, new TypeRef<Stock>() {});

    Stock stock;
    while((stock = reader.readNext()) != null) {
      System.out.println(ToStringBuilder.reflectionToString(stock));
    }

    IOUtils.closeStream(inputStream);
View Full Code Here

    ProtobufBlockReader<StockAvg> reader =
        new ProtobufBlockReader<StockAvg>(
            inputStream, new TypeRef<StockAvg>() {});

    StockAvg stock;
    while((stock = reader.readNext()) != null) {
      System.out.println(ToStringBuilder.reflectionToString(stock));

    }
View Full Code Here

TOP

Related Classes of com.manning.hip.ch3.TextArrayWritable

Copyright © 2018 www.massapicom. 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.