NetcdfFileWriteable strangeness on attempted file overwrite

I'm not at all sure if this is intended behavior of the Java netcdf API for the NetcdfFileWriteable class, so I am not claiming this to be a bug, it just seems strange to me. Using nc2.2, OS is Redhat Enterprise Linux, JDK is Sun's 1.4.2_05...

I am using the NetcdfFileWriteable class as such

NetcdfFileWriteable ncw = new NetcdfFileWriteable( "", b );
add dims, vars
write data

where boolean b = true or false, makes no difference to the following observed behavior.

Now, I want my app to hose any existing file, i.e. my app knows what needs to be written to, and any previous contents are irrelevant. Depending on the config of my app, different amounts of data are intended to be written to My app always writes all of the data for all variables defined, so no 'fill' is required.

Now, the strange part is that if exists and I run my app, the contents of will only change if the total size of the new dataset in bytes is larger than the existing size of the file If the app intends to write a smaller total number of bytes to than is currently on the disk, say to define fewer variables than a previous run, then the new contents are not written.

Even more strangely, no matter if the file contents are or are not updated, the timestamp (file modification time on Unix??) of the file is updated unconditionally.

So, in short, my app will have to remove the file if it exists to be sure of the correct final contents of the file??

As I said, maybe this is as it all should be. If so, are there docs to show this? The javadoc comments for the class suggest to me that what I want to happen, should happen, but it isn't happening ;)

Any clarifications appreciated