Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try {
- RandomAccessFile arq = new RandomAccessFile("teste.txt", "r");
- try{
- while(arq.read() != -1) {
- String palavra = "";
- offset = arq.getFilePointer();
- letra = (char)arq.read();
- while (letra != ' ' && letra != 'n') {
- palavra += letra;
- letra = (char)arq.read();
- }
- palavra = palavra.toLowerCase();
- System.out.println(palavra);
- if (h.PesquisaRegistro(palavra) == null) {
- x = new Registro(palavra, offset);
- h.Inserir(x, h.HashCode(x));
- } else {
- x = h.PesquisaRegistro(palavra);
- x.quantidade++;
- h.tabela.replace(h.PesquisaChave(palavra), x);
- }
- }
- }catch(EOFException ex){
- }
- } catch (IOException e) {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement