Presentation is loading. Please wait.

Presentation is loading. Please wait.

IB103 Week 10 Files CHAPTER 19. Files RAM vs. Files of CD or HD Fasterslower Costs morecheaper Temporarypermanent Stores whilecopied to RAM to Executingexecute.

Similar presentations


Presentation on theme: "IB103 Week 10 Files CHAPTER 19. Files RAM vs. Files of CD or HD Fasterslower Costs morecheaper Temporarypermanent Stores whilecopied to RAM to Executingexecute."— Presentation transcript:

1 IB103 Week 10 Files CHAPTER 19

2 Files RAM vs. Files of CD or HD Fasterslower Costs morecheaper Temporarypermanent Stores whilecopied to RAM to Executingexecute Size 32, to 128, 256…floppy 1.4M CD 650 MB, HD Billions Bytes

3 Files security and Applets Downloaded from a web page run via java enabled browser or appletviewer on users PC. (security rules for applets in Java – very strict, examples can not read, write to local files only communicate with original server etc. by default

4 Streams – bytes continuous Essentials of streams: (In) 1. Open file 2. Read data into variables 3. Close file (Out) 1. Open file 2. Output/write items in required sequence 3. Close file

5 Buffer – a “chunk” of memory “Spoon fed” to a device, like a printer that is much slower that CPU. The CPU can is then free to run full speed until another buffer full is needed by the device

6 File example in text “FileDemo1” File input See “FileDemo1” File Search See “FileSearch” – seeks a string within the file “FileDialog” “gets” a file, uses a window with a “load” button

7 FileDemo1 try{ outFile = new PrintWriter( new FileWriter("testout.txt"), true); outFile.print(inputTextArea.getText() ); outFile.close(); }

8 FileDemo1 part 2 catch (IOException e) { System.err.println("File Error: " + e.toString() ); System.exit(1); }

9 The System Class.in,.out,.err (input/output/error) Command Line Input/ Output Java Console


Download ppt "IB103 Week 10 Files CHAPTER 19. Files RAM vs. Files of CD or HD Fasterslower Costs morecheaper Temporarypermanent Stores whilecopied to RAM to Executingexecute."

Similar presentations


Ads by Google