Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static List<Registro> getRegistros() throws IOException {
- InputStream is = new FileInputStream("teste.txt");
- InputStreamReader isr = new InputStreamReader(is);
- BufferedReader br = new BufferedReader(isr);
- List<Registro> registros = new ArrayList<>();
- String s = br.readLine();
- String subID;
- while (s != null) {
- subID = s.substring(0, s.indexOf(' '));
- String auxID[] = subID.split("_");
- s = s.substring(s.indexOf(' ') + 1, s.length());
- List<String> autores = new ArrayList<>();
- String aux[] = s.split("<>");
- String autoresList[] = aux[0].split(";");
- for (int i = 0; i < autoresList.length; i++) {
- autores.add(autoresList[i]);
- }
- String titulo = aux.length > 1 ? aux[1] : "";
- String congresso = aux.length > 2 ? aux[2] : "";
- Registro r = new Registro(autores, titulo, congresso, Integer.parseInt(auxID[0]),
- Integer.parseInt(auxID[1]));
- registros.add(r);
- s = br.readLine();
- }
- br.close();
- return registros;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement