April 05
Prof. Ismael H. F. Santos -  ismael@tecgraf.puc-rio.br                                                          2
Exemplo de stream de dados
ntry {
n  FileInputStream fin = new FileInputStream(“arquivo.dat”);
n  DataInputStream din = new DataInputStream(fin);
n  int num_valores = din.readInt();
n  double[] valores = new double[num_valores];
n  for (int i = 0 ; i < num_valores ; i++)
n     valores[i] = din.readDouble();
n} catch (EOFException e) {
n   …
n} catch (FileNotFoundException e) {
n   …
n} catch (IOException e) {
n   …
n}
n