Skip to content

Instantly share code, notes, and snippets.

@djuniorscjr
djuniorscjr / example.java
Last active Sep 4, 2016
Example read file using java 8
View example.java
final String relativePath = PATH_ARQUIVO.CSV;
final ClassLoader classLoader = getClass().getClassLoader();
final InputStream resourceAsStream = classLoader.getResourceAsStream(relativePath);
try (BufferedReader buffer = new BufferedReader(new InputStreamReader(resourceAsStream))) {
buffer.lines().collect(Collectors.toList()).forEach(line -> {
final String[] arrayBank = line.split(";");
String value = line[COLUNA_TIPO_MOEDA];
});
}