MATLAB REAL-TIME WORKSHOP 7 - TARGET LANGUAGE COMPILER Manual de usuario Pagina 245

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 408
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 244
Example – Creating and Using a Phone Book
5-75
if r == 'y',
try
FOS = java.io.FileOutputStream(pbname);
FOS.close
catch
error(sprintf('Failed to create %s', pbname));
end;
else
return;
end;
end;
3. Create a Hash Table
The example constructs a java.util.Properties object to serve as the hash
table for the data dictionary.
pb_htable = java.util.Properties;
4. Create a File Input Stream
In a try block, the example invokes a FileInputStream constructor with the
name of the phone book file, assigning the object to
FIS. If the call fails, the
catch statement displays an error message and terminates the program.
try
FIS = java.io.FileInputStream(pbname);
catch
error(sprintf('Failed to open %s for reading.', pbname));
end;
5. Load the Phone Book Keys and Close the File Input Stream
The example calls load on the FileInputStream object FIS, to load the phone
book keys and their values (if any) into the hash table. It then closes the file
input stream.
pb_htable.load(FIS);
FIS.close;
Vista de pagina 244
1 2 ... 240 241 242 243 244 245 246 247 248 249 250 ... 407 408

Comentarios a estos manuales

Sin comentarios