Adelphia web hosting - Chapter 16 Files and Streams 929 0 100

Chapter 16 Files and Streams 929 0 100 200 300 400 500 byte offsets 100 100 100 100 100 100 bytes bytes bytes bytes bytes bytes Fig. 16.10Java s view of a random-access file. 16.10 The next several sections introduce the techniques necessary to create this credit-processing program. Figure 16.11 contains the RandomAccessAccountRecordclass that is used by the next four programs for both reading records from and writing records to a file. 1 // Fig. 16.11: RandomAccessAccountRecord.java 2 // Subclass of AccountRecord for random access file programs. 3 package com.deitel.jhtp4.ch16; 4 5 // Java core packages 6 import java.io.*; 7 8 public class RandomAccessAccountRecord extends AccountRecord { 9 10 // no-argument constructor calls other constructor 11 // with default values 12 public RandomAccessAccountRecord() 13 { 14 this( 0, “”, “”, 0.0 ); 15 } 16 17 // initialize a RandomAccessAccountRecord 18 public RandomAccessAccountRecord( int account, 19 String firstName, String lastName, double balance ) 20 { 21 super( account, firstName, lastName, balance ); 22 } 23 24 // read a record from specified RandomAccessFile 25 public void read( RandomAccessFile file ) throws IOException 26 { 27 setAccount( file.readInt() ); 28 setFirstName( padName( file ) ); 29 setLastName( padName( file ) ); 30 setBalance( file.readDouble() ); 31 } 32 Fig. 16.11 RandomAccessAccountRecordclass used in the random-access file programs (part 1 of 2).
From our experience, we can recommend PHP5 Web Hosting services, if you need affordable webhost to host and run your web application.

Leave a Reply