Site navigation: [ Home | Theory | Java | About ]


SL students can even use SQL statements to save, retrieve and edit records in an external (eg Access) database.

This was mentioned in the May 2006 Subject Report (essential reading on mastery aspects).


.Java has a number of different ways to handle file i/o; any of them are appropriate to SL mastery factors the situation for HL is more complex. The mastery factors for HL are:

  • adding data to an instance of RandomAccessFile Class
  • deleting data from an instance of RandomAccessFile Class
  • searching for specified data in an instance of RandomAccessFile Class
  • parsing a text file (or other data stream)

The file handling in an HL dossier needs some thought because the requirements of the application will also determine the file structure that is required. This topic will obviously relate to the theory topic, Topic 7. The different structures described there and the links to be found here are:

File Structure Name Structure Details Access Method (searching) Links to Java examples
Sequential file Ordered or unordered records Sequential access

The dead simple approach, serialization of an array so the entire thing can be written to file.

Text files Not in IB Guide Not in IB Guide Also a useful way for SL students to do file handling.
Partially-indexed file Ordered records Sequential access to index, followed by direct access to the first record in the group, then sequential access to find the desired record. Example of maintaining an ordered RandomAccessFile .
Fully-indexed file Unordered records Sequential access to the index, followed by direct access to the data file.  
Direct access file Unordered or ordered records A calculation provides the address (location) of a record, followed by direct access to the record.  

Searching a data file can be a long process unless a special type of search (binary search) is applied. However, this method can only be applied to sorted collections of records . Therefore searching and sorting will also be included in this section.

These pages were written in a sequence (as indicated by the navigation bar at the bottom of each page, however it is not neccessary to follow this order, hopefully each segment stands alone.

Related: [ Java home | Next: serialization ]

See this page for an example and some further suggestions of using text files in a dossier.

The site is partly financed by advertising revenue, partly by online teaching activities and partly by donations. If you or your organisation feel these resouces have been useful to you, please consider a donation, $9.95 is suggested. Please report any issues with the site, such as broken links, via the feedback page, thanks.

Questions or problems related to this web site should be addressed to Richard Jones who asserts his right to be identified as the author and owner of these materials - unless otherwise indicated. Please feel free to use the material presented here and to create links to it for non-commercial purposes; an acknowledgement of the source is required by the Creative Commons licence. Use of materials from this site is conditional upon your having read the additional terms of use on the about page and the Creative Commons Licence. View privacy policy.

Creative Commons License

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License. © 2001 - 2009 Richard Jones, PO BOX 246, Cambridge, New Zealand;
This page was last modified: October 28, 2013