public class WinFile
extends java.lang.Object
There are 4 flags:
A file object is created whenever a file is "opened". The file position is set to point just after the header. The file object is called upon when:
The file MAY also be a directory that is opened via a normal open only call. If filePosition=fileSize the we're at EOF. Each file has a "clusterchain", an arraylist with the number of the cluster for a part of the file.
Modifier and Type | Field and Description |
---|---|
protected java.nio.ByteBuffer |
buffer |
protected java.util.ArrayList<java.lang.Integer> |
clusterchain |
protected WinDir |
dir |
protected boolean |
dirChanged |
protected WinDrive |
drive |
protected boolean |
fileChanged |
protected int |
filePosition |
protected int |
fileSize |
protected int |
index |
protected boolean |
isDir |
protected boolean |
mapChanged |
protected boolean |
readOnly |
protected boolean |
setDate |
Constructor and Description |
---|
WinFile()
Do not call this way of opening for real.
|
WinFile(WinDrive drive,
WinDir dir,
int index,
boolean readOnly,
java.nio.ByteBuffer buf,
java.util.ArrayList<java.lang.Integer> cchain)
Creates the object.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this file : writes the file to disk if need be.
|
WinDir |
getDir()
Gets the directory this file is in.
|
int |
getIndex()
Gets the file index.
|
void |
handleTrap3(int trapKey,
MC68000Cpu cpu)
This dispatches the file I/O routines (=SMSQE TRAP#3 routines).
|
void |
setDir(WinDir newDir)
Sets the directory this file is in.
|
void |
setDirAndFatChanged()
Show that the directory and the FAT must have changed.
|
void |
setDirStatus(boolean dirstat)
Sets whether this file is a dir or not.
|
void |
setIndex(int newIndex)
Sets the file index.
|
void |
writeFile(int start,
int nbr)
Writes all or part of this file back to the disk.
|
protected int filePosition
protected int fileSize
protected java.nio.ByteBuffer buffer
protected int index
protected WinDir dir
protected WinDrive drive
protected boolean readOnly
protected boolean isDir
protected java.util.ArrayList<java.lang.Integer> clusterchain
protected boolean fileChanged
protected boolean dirChanged
protected boolean mapChanged
protected boolean setDate
public WinFile(WinDrive drive, WinDir dir, int index, boolean readOnly, java.nio.ByteBuffer buf, java.util.ArrayList<java.lang.Integer> cchain)
drive
- the WinDrive the file is on.dir
- the directory where this file is in.index
- index into the buffer of the dir containing this file (if file is not the root dir) (this index point to the file header for this file).readOnly
- set to true of this file is opened for read only access.buf
- the buffer to be used by this file.cchain
- the clusterchain for this object.public WinFile()
public void close()
public void handleTrap3(int trapKey, MC68000Cpu cpu)
trapKey
- what kind of trap#3 are we dealing with?cpu
- the CPU.public void writeFile(int start, int nbr)
start
- where to start writing from (index into the buffer).nbr
- how many bytes to write.
Note: if both start and nbr are 0, the entire file is written.public void setDirStatus(boolean dirstat)
dirstat
- is true if this file is to be a dir.public WinDir getDir()
public void setDir(WinDir newDir)
newDir
- the new directory this file is in.public int getIndex()
public void setIndex(int newIndex)
newIndex
- the new index into the directory.public void setDirAndFatChanged()