1 package club.wpia.gigi.util;
4 import java.io.PrintWriter;
6 public class HighFinancialValueFetcherAlexa extends HighFinancialValueFetcher {
8 public HighFinancialValueFetcherAlexa(File f, int max) {
9 super(f, max, "https://s3.amazonaws.com/alexa-static/top-1m.csv.zip");
13 public void handle(String line, PrintWriter fos) {
14 String[] parts = line.split(",");
16 // Assert that the value before the "," is an integer
18 if (Integer.parseInt(parts[0]) < 1) {
19 throw new NumberFormatException("We expect a number greater then zero for the first column.");
21 } catch (NumberFormatException nfe) {
22 // Bail on lines with invalid first field
23 throw new Error("Invalid format of first column.", nfe);
27 System.out.println(parts[1]);