Arquivo.java 875 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package cache;
  7. import java.io.FileNotFoundException;
  8. import java.io.FileReader;
  9. import java.util.Scanner;
  10. /**
  11. *
  12. * @author Juninho Carlos
  13. */
  14. public class Arquivo {
  15. private Scanner in;
  16. String s;
  17. public Arquivo(String path) throws FileNotFoundException {
  18. in = new Scanner(new FileReader(path));
  19. }
  20. public boolean lerArquivo(){
  21. return this.in.hasNextLine();
  22. }
  23. public Requisicao getRequisicao(){
  24. this.s = in.nextLine();
  25. boolean read = s.contains("r");
  26. String teste = s.substring(1);
  27. Long add = new Long(teste);
  28. return new Requisicao(add, read);
  29. }
  30. }