As part of opening the file BaseFile calls setInternals(), this
sets any "internal" information and initializes the header. For this class, we need
a relatively simple method:
protected void setInternals () {
if (header == null) { // 1
initHeader(); // 2
} // 3
if ((flags & APPEND) != 0) seek(getSize()); // 4
else seek(0.0); // 5
}
-
Line 1: BaseFile will call this method twice if file qualifiers
were specified. The first call is intended to initialize the header, the second
make any updates necessary following the qualifiers.
-
Line 2: The first time this method is called we want to initialize the
header. We will have a separate method initHeader() for this.
-
Lines 4-5: We need to set the seek pointer (more about this later)
to start at either the beginning or the end of the data portion of the file.