Package drivers.nxfa
Class SfaFileheader
java.lang.Object
drivers.nxfa.SfaFileheader
- All Implemented Interfaces:
XfaFileheader
Creates an SMSQE fileheader for SFA files.
-
Constructor Summary
ConstructorsConstructorDescriptionSfaFileheader
(File f, String filename, FileChannel inoutChannel, int lengthIfDir) Creates the object either from an existingjava.io.File
, or a newly created one. -
Method Summary
Modifier and TypeMethodDescriptionboolean
flushHeader
(FileChannel inoutChannel, boolean setDate) Actually writes the header to the file.int
Gets the dataspace.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 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
setSMSQEFilename
(String filename) Sets the (SMSQE) filename in the header.void
setVersion
(int version) Sets the version in the header.int
writeFileHeader
(MC68000Cpu cpu, int position) Writes the first 14 bytes of the fileheader from SMSQE to the SFA header.
-
Constructor Details
-
SfaFileheader
public SfaFileheader(File f, String filename, FileChannel inoutChannel, int lengthIfDir) throws IOException Creates the object either from an existingjava.io.File
, or a newly created one.- Parameters:
f
- the file.filename
- the filename.inoutChannel
- a channel for reading the existing header.lengthIfDir
- length if file if it is a directory.- Throws:
IOException
- from java io operations.
-
-
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 memory the header should be written.bufflen
- how many bytes to write.- Returns:
- nbr of bytes read
- See Also:
-
writeFileHeader
Writes the first 14 bytes of the fileheader from SMSQE to the SFA header.- Specified by:
writeFileHeader
in interfaceXfaFileheader
- Parameters:
cpu
- the cpu with the memory from where to read the header.position
- the mem position in smsqe's memory map.- Returns:
- always 14 = nbr of bytes written.
- See Also:
-
flushHeader
Actually writes the header to the file.- Specified by:
flushHeader
in interfaceXfaFileheader
- Parameters:
inoutChannel
- The channel to write to.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
-
getOffset
public int getOffset()Gets the header offset.- Specified by:
getOffset
in interfaceXfaFileheader
- Returns:
- the offset as int.
- See Also:
-
getSMSQEFilename
Gets the (SMSQE) filename from the header.- Specified by:
getSMSQEFilename
in interfaceXfaFileheader
- Returns:
- the filename as a Java
String
.
-
setSMSQEFilename
Sets the (SMSQE) filename in the header.- Specified by:
setSMSQEFilename
in interfaceXfaFileheader
- Parameters:
filename
- the name to set.
-
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- Returns:
- the date of the file in smsqe format (date and time in seconds as of 1.1.1961.
-
setDate
public void setDate(int whatDate, int dateToSet) Sets the date in the header.- Specified by:
setDate
in interfaceXfaFileheader
- Parameters:
whatDate
- what date do we want : 0 update date 2 : backup datedateToSet
- the date to set as an SMSQE date (date and time in seconds as of 1.1.1961).. Contrary to the normal documentation, this will NOT set the backup date for a read only file!!!!!!!!!!
-
getVersion
public int getVersion()Gets the version of the file from the header.- Specified by:
getVersion
in interfaceXfaFileheader
- Returns:
- the file version
-
setVersion
public void setVersion(int version) Sets the version in the header.- Specified by:
setVersion
in interfaceXfaFileheader
- Parameters:
version
- the date to set as an SMSQE date (date and time in seconds as of 1.1.1961).. Contrary to the normal documentation, this will NOT set the backup date for a read only file!!!!!!!!!!
-
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.
-
isExecutable
public boolean isExecutable()Checks whether file is executable.- Specified by:
isExecutable
in interfaceXfaFileheader
- Returns:
- true if file is executable.
-
getDataSpace
public int getDataSpace()Gets the dataspace.- Specified by:
getDataSpace
in interfaceXfaFileheader
- Returns:
- the dataspace if any, or 0 if none
-