2. Agenda RandomAccessFile overview Implement CRUD functions by RandomAccessFile Use case diagram Sequence diagram Class diagram classes 2
3. What is RandomAccessFile? A random access file behaves like a large array of bytes stored in the file system. There is a kind of cursor, or index into the implied array, called the file pointer; input operations read bytes starting at the file pointer and advance the file pointer past the bytes read. Random-access files are solution Instant access Insert record without destroying other data Update/delete items without changing other data 3
4. What is RandomAccessFile? imposes no structure on files Programmer must create random-access files Simplest way: fixed-length records Calculate position in file from record size and key 4
9. DVDClient.java Play the role of client to do CRUD C (Create): addDVD() R (Read): findAll() and findByCriteria() U (Update): modifyDVD() D (Delete): deleteDVD 9