Package drivers.nxfa

Class NfaFileheader

java.lang.Object
drivers.nxfa.NfaFileheader
All Implemented Interfaces:
XfaFileheader

public class NfaFileheader extends Object implements XfaFileheader
Simulates an SMSQE fileheader for files on an NFA device.
  • Constructor Summary

    Constructors
    Constructor
    Description
    NfaFileheader(File f, String filename, int dataSpaceOrLengthIfDir, boolean useXTcc)
    Creates the object for an existing java.io.File.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    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
    Sets the date of the file (in milliseconds)
    void
    setLength(int length)
    Sets the length of the file in the header.
    void
    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...

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • NfaFileheader

      public NfaFileheader(File f, String filename, int dataSpaceOrLengthIfDir, boolean useXTcc)
      Creates the object for an existing java.io.File.
      Parameters:
      f - the existing file
      filename - the smsqe filename for this file.
      dataSpaceOrLengthIfDir - length of the file if it is a directory, else possible dataspace if XTcc file
      useXTcc - true if executable files are maked with an XTcc field.
  • Method Details

    • readFileheader

      public int readFileheader(MC68000Cpu cpu, int position, int bufflen)
      "Reads" the file header into the SMSQE buffer.
      Specified by:
      readFileheader in interface XfaFileheader
      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

      public int writeFileHeader(MC68000Cpu cpu, int position)
      Writes the fileheader from SMSQE to the NFA - except that it doesn't...
      Specified by:
      writeFileHeader in interface XfaFileheader
      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 interface XfaFileheader
      Returns:
      the offset as int, always 0.
      See Also:
    • flushHeader

      public boolean flushHeader(FileChannel inoutChannel, boolean setDate)
      Normally writes the header to disk, but here we don't flush the header at all!
      Specified by:
      flushHeader in interface XfaFileheader
      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

      public String getSMSQEFilename()
      Gets the (SMSQE) filename from the header.
      Specified by:
      getSMSQEFilename in interface XfaFileheader
      Returns:
      the (SMSQE) filename as a Java String.
    • setSMSQEFilename

      public void setSMSQEFilename(String name)
      Sets the (SMSQE) filename in the header - but does nothing here.
      Specified by:
      setSMSQEFilename in interface XfaFileheader
      Parameters:
      name - ignored.
    • getDate

      public int getDate(int whatDate)
      Gets the date of the file from the header.
      Specified by:
      getDate in interface XfaFileheader
      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 interface XfaFileheader
      Parameters:
      whatDate - what date do we want to set : 0 = update date 2 = backup date
      dateToSet - 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 interface XfaFileheader
      Returns:
      ALWAYS 0
    • setVersion

      public void setVersion(int version)
      Sets the version in the header.
      Specified by:
      setVersion in interface XfaFileheader
      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

      public void setFileDates(File f)
      Sets the date of the file (in milliseconds)
      Specified by:
      setFileDates in interface XfaFileheader
      Parameters:
      f - the file for which the date should be set.
    • getAttrs

      public static final int getAttrs(File f)
      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 interface XfaFileheader
      Returns:
      true if it is.
    • getDataSpace

      public int getDataSpace()
      Gets the dataspace for an executable file.
      Specified by:
      getDataSpace in interface XfaFileheader
      Returns:
      the dataspace if any, or 0 if none