When using an object of type FileInputStream
and FileOutputStream
inside a try-catch-resources java automatically uses the close () but is flush () automatic or not?
// Exemplo
try(FileOutputStream fos = new FileOutputStream("arquivo.txt")){
try (BufferedOutputStream bos = new BufferedOutputStream(fos)) {
bos.write("Teste");
bos.flush(); // Precisa usar o flush()
}
fos.flush(); // Precisa usar o flush()
}