Advertisement
Guest User

Untitled

a guest
Aug 17th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. try {
  2. RandomAccessFile arq = new RandomAccessFile("teste.txt", "r");
  3. try{
  4. while(arq.read() != -1) {
  5. String palavra = "";
  6. offset = arq.getFilePointer();
  7. letra = (char)arq.read();
  8. while (letra != ' ' && letra != 'n') {
  9. palavra += letra;
  10. letra = (char)arq.read();
  11. }
  12. palavra = palavra.toLowerCase();
  13. System.out.println(palavra);
  14. if (h.PesquisaRegistro(palavra) == null) {
  15. x = new Registro(palavra, offset);
  16. h.Inserir(x, h.HashCode(x));
  17. } else {
  18. x = h.PesquisaRegistro(palavra);
  19. x.quantidade++;
  20. h.tabela.replace(h.PesquisaChave(palavra), x);
  21. }
  22. }
  23. }catch(EOFException ex){
  24. }
  25. } catch (IOException e) {
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement