📄 arquivos.java
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package laforehash;import java.io.BufferedReader;import java.io.File;import java.io.FileNotFoundException;import java.io.FileReader;import java.io.IOException;import java.util.StringTokenizer;/** * * @author Usuario */ class Arquivos { public SortedList filesolicitacoes () throws FileNotFoundException, IOException{ SortedList listavagas = new SortedList(); File solicitacoes = new File ("C:/Documents and Settings/Usuario/Meus documentos/javaprog/vagas.txt "); FileReader reader2 = new FileReader(solicitacoes); //criar uma referência pro arquivo criado BufferedReader leitor2 = new BufferedReader(reader2); while (leitor2.readLine() != null) { Vagas vagas = new Vagas(); StringTokenizer st = new StringTokenizer(leitor2.readLine()); vagas.setId(Integer.parseInt(st.nextToken("/"))); vagas.setQuantidade(Integer.parseInt(st.nextToken("/"))); vagas.setFormacao(st.nextToken("/")); vagas.setGraduacao(st.nextToken("/")); listavagas.insertList(vagas); } return listavagas;} public HashTable filecandidato () throws FileNotFoundException, IOException { HashTable theHashTable = new HashTable(10); File candidato = new File ("C:/Documents and Settings/Usuario/Meus documentos/javaprog/candidatos.txt "); //apontar pro arquivo FileReader reader = new FileReader(candidato); //criar uma referência pro arquivo criado BufferedReader leitor = new BufferedReader(reader); while (leitor.readLine() != null) { Candidato theLink = new Candidato(); StringTokenizer st = new StringTokenizer(leitor.readLine()); theLink.setFormacao(st.nextToken("/")); theLink.setNome(st.nextToken("/")); theLink.setGraduacao(st.nextToken("/")); theLink.setCpf(st.nextToken("/")); theLink.setId(Integer.parseInt(st.nextToken("/"))); theLink.setStatus(st.nextToken("/")); theHashTable.aux(theLink); } return theHashTable; } public SortedList fileempresas() throws IOException, FileNotFoundException { SortedList listaempresas = new SortedList(); File companias = new File ("C:/Documents and Settings/Usuario/Meus documentos/javaprog/empresa.txt "); FileReader reader3 = new FileReader(companias); //criar uma referência pro arquivo criado BufferedReader leitor3 = new BufferedReader(reader3); while (leitor3.readLine() != null){ Empresa empresa = new Empresa(); StringTokenizer st = new StringTokenizer(leitor3.readLine()); empresa.setId(Integer.parseInt(st.nextToken("/"))); empresa.setNome(st.nextToken("/")); empresa.setTel(st.nextToken("/")); listaempresas.insertList(empresa); } return listaempresas; } } // fim da classe
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -