Пример #1
0
  /** @param args */
  public static void main(String[] args) {
    int i = 1;

    ArrayList<Objeto> list = new ArrayList<Objeto>();
    PDFReader pdf = new PDFReader();

    pdf.setEnderecoRecurso("http://www.ribeiraopreto.sp.gov.br/transerp/i07radar.pdf");
    String lista = pdf.getConteudo();
    lista = lista.toUpperCase();
    lista = lista.replace("\r", "");
    String[] valor = lista.split("\n");

    while (i < (valor.length - 3)) {
      Objeto ob = new Objeto();
      ob.setRua1(valor[i]);
      ob.setRua2(valor[i + 1]);
      ob.setRua3(valor[i + 2]);
      // ob.setRua4(valor[i + 3]);
      String[] dia = valor[i + 4].split(" ");
      ob.setDia(dia[(dia.length - 1)]);
      ob.setDiaSemana(valor[i + 5]);

      int j = 0;
      while (j < (valor.length)) {
        if (valor[j].contains("RADAR FIXO:")) {
          ob.setRua4(valor[j]);
        }
        j++;
      }

      list.add(ob);
      i = i + 6;
    }

    String hoje = "29/4/2014";

    for (int j = 1; j < list.size(); j++) {
      // System.out.println(list.get(j).getDia());
      if (list.get(j).getDia().equals(hoje)) {
        // Insert.insert(list.get(j).getRua1(), list.get(j).getDia());
        // Insert.insert(list.get(j).getRua2(), list.get(j).getDia());
        // Insert.insert(list.get(j).getRua3(), list.get(j).getDia());
        // Insert.insert(list.get(j).getRua4(), list.get(j).getDia());

        System.out.println(list.get(j).getDiaSemana() + " " + list.get(j).getDia());
        System.out.println();
        System.out.println(list.get(j).getRua1());
        System.out.println(list.get(j).getRua2());
        System.out.println(list.get(j).getRua3());
        System.out.println(list.get(j).getRua4().replace(" -", "").replace(".", ""));
        System.out.println();
      }
    }
  }
 public static void main(String[] args) {
   if (args.length > 0) {
     String command = args[0];
     String[] arguments = new String[args.length - 1];
     System.arraycopy(args, 1, arguments, 0, arguments.length);
     boolean exitAfterCallingMain = true;
     try {
       if (command.equals("ConvertColorspace")) {
         ConvertColorspace.main(arguments);
       } else if (command.equals("Decrypt")) {
         Decrypt.main(arguments);
       } else if (command.equals("Encrypt")) {
         Encrypt.main(arguments);
       } else if (command.equals("ExtractText")) {
         ExtractText.main(arguments);
       } else if (command.equals("Overlay")) {
         Overlay.main(arguments);
       } else if (command.equals("PrintPDF")) {
         PrintPDF.main(arguments);
       } else if (command.equals("PDFDebugger")) {
         PDFDebugger.main(arguments);
         exitAfterCallingMain = false;
       } else if (command.equals("PDFMerger")) {
         PDFMerger.main(arguments);
       } else if (command.equals("PDFReader")) {
         PDFReader.main(arguments);
         exitAfterCallingMain = false;
       } else if (command.equals("PDFSplit")) {
         PDFSplit.main(arguments);
       } else if (command.equals("PDFToImage")) {
         PDFToImage.main(arguments);
       } else if (command.equals("TextToPDF")) {
         TextToPDF.main(arguments);
       } else if (command.equals("WriteDecodedDoc")) {
         WriteDecodedDoc.main(arguments);
       } else {
         showMessageAndExit();
       }
       if (exitAfterCallingMain) {
         System.exit(0);
       }
     } catch (Exception e) {
       System.err.println(command + " failed with the following exception:");
       e.printStackTrace();
       System.exit(1);
     }
   } else {
     showMessageAndExit();
   }
 }