Package drivers.nxfa
Class NfaFileheader
java.lang.Object
drivers.nxfa.NfaFileheader
- All Implemented Interfaces:
XfaFileheader
Simulates an SMSQE fileheader for files on an NFA device.
-
Constructor Summary
ConstructorsConstructorDescriptionNfaFileheader
(File f, String filename, int dataSpaceOrLengthIfDir, boolean useXTcc) Creates the object for an existing java.io.File. -
Method Summary
Modifier and TypeMethodDescriptionboolean
flushHeader
(FileChannel inoutChannel, boolean setDate) Normally writes the header to disk, but here we don't flush the header at all!static final int
Try to get some attributes for a file.int
Gets the dataspace for an executable file.int
getDate
(int whatDate) Gets the date of the file from the header.int
Gets the header offset.Gets the (SMSQE) filename from the header.int
Gets the version of the file from the header.boolean
Checks whether a file is executable.int
readFileheader
(MC68000Cpu cpu, int position, int bufflen) "Reads" the file header into the SMSQE buffer.void
setDate
(int whatDate, int dateToSet) Sets the date in the header.void
setFileDates
(File f) Sets the date of the file (in milliseconds)void
setLength
(int length) Sets the length of the file in the header.void
setSMSQEFilename
(String name) Sets the (SMSQE) filename in the header - but does nothing here.void
setVersion
(int version) Sets the version in the header.int
writeFileHeader
(MC68000Cpu cpu, int position) Writes the fileheader from SMSQE to the NFA - except that it doesn't...
-
Constructor Details
-
NfaFileheader
Creates the object for an existing java.io.File.- Parameters:
f
- the existing filefilename
- the smsqe filename for this file.dataSpaceOrLengthIfDir
- length of the file if it is a directory, else possible dataspace if XTcc fileuseXTcc
- true if executable files are maked with an XTcc field.
-
-
Method Details
-
readFileheader
"Reads" the file header into the SMSQE buffer.- Specified by:
readFileheader
in interfaceXfaFileheader
- Parameters:
cpu
- the cpu with the memory.position
- where in that buffer to put it.bufflen
- (length of that buffer)= how many bytes to get (not more!).- Returns:
- the number of bytes read.
-
writeFileHeader
Writes the fileheader from SMSQE to the NFA - except that it doesn't...- Specified by:
writeFileHeader
in interfaceXfaFileheader
- Parameters:
cpu
- the cpu with the memory.position
- position in cpu memory whence to write.- Returns:
- number of bytes written.
-
getOffset
public int getOffset()Gets the header offset.- Specified by:
getOffset
in interfaceXfaFileheader
- Returns:
- the offset as int, always 0.
- See Also:
-
flushHeader
Normally writes the header to disk, but here we don't flush the header at all!- Specified by:
flushHeader
in interfaceXfaFileheader
- Parameters:
inoutChannel
- ignored. #param setDate ignored.setDate
- = true if the date should be set to that of the channel's closing.- Returns:
- true if the file dates should be set after closing the file
-
getSMSQEFilename
Gets the (SMSQE) filename from the header.- Specified by:
getSMSQEFilename
in interfaceXfaFileheader
- Returns:
- the (SMSQE) filename as a Java
String
.
-
setSMSQEFilename
Sets the (SMSQE) filename in the header - but does nothing here.- Specified by:
setSMSQEFilename
in interfaceXfaFileheader
- Parameters:
name
- ignored.
-
getDate
public int getDate(int whatDate) Gets the date of the file from the header.- Specified by:
getDate
in interfaceXfaFileheader
- Parameters:
whatDate
- what date do we want : 0 update date 2 : backup date this is ignored here, both are always the same- Returns:
- the date of the file in smsqe format (date and time in seconds as of 1.1.1961, or always 0 if backup date.
-
setDate
public void setDate(int whatDate, int dateToSet) Sets the date in the header. This only work for the update date.- Specified by:
setDate
in interfaceXfaFileheader
- Parameters:
whatDate
- what date do we want to set : 0 = update date 2 = backup datedateToSet
- the date to set as an SMSQE date (date and time in seconds as of 1.1.1961)..
-
getVersion
public int getVersion()Gets the version of the file from the header.- Specified by:
getVersion
in interfaceXfaFileheader
- Returns:
- ALWAYS 0
-
setVersion
public void setVersion(int version) Sets the version in the header.- Specified by:
setVersion
in interfaceXfaFileheader
- Parameters:
version
- the version to set
-
setLength
public void setLength(int length) Sets the length of the file in the header.- Parameters:
length
- the length to set
-
setFileDates
Sets the date of the file (in milliseconds)- Specified by:
setFileDates
in interfaceXfaFileheader
- Parameters:
f
- the file for which the date should be set.
-
getAttrs
Try to get some attributes for a file.- Parameters:
f
- the file to set attributes for.- Returns:
- a bitmap of file attributes : (high bit) ADVSHR (low bit) or 0 if this isn't supported by the OS.+ where : ADVSHR A archive D directory V (NOT USED) S system H hidden R read only
-
isExecutable
public boolean isExecutable()Checks whether a file is executable.- Specified by:
isExecutable
in interfaceXfaFileheader
- Returns:
- true if it is.
-
getDataSpace
public int getDataSpace()Gets the dataspace for an executable file.- Specified by:
getDataSpace
in interfaceXfaFileheader
- Returns:
- the dataspace if any, or 0 if none
-