Class SpjFile


  • public class SpjFile
    extends java.lang.Object
    Provide tools for reading, writing and accessing Digitrax SPJ files.

    Four-byte quantities in SPJ files are little-endian.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      (package private) class  SpjFile.FirstHeader
      Class representing first header
      class  SpjFile.Header
      Class representing a header record.
    • Constructor Summary

      Constructors 
      Constructor Description
      SpjFile​(java.io.File file)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void dispose()  
      SpjFile.Header findSdfHeader()  
      java.lang.String getComment()  
      SpjFile.Header getHeader​(int index)  
      java.lang.String getMapEntry​(int i)
      Find the map entry (character string) that corresponds to a particular handle number.
      (package private) void loadMapCache()  
      int numHeaders()
      Number of headers present in the file.
      void read()
      Read the file whose name was provided earlier.
      void save​(java.lang.String name)
      Save this file.
      (package private) void writeSubFile​(int i, java.lang.String name)
      Write the content from a specific header as a new "subfile".
      void writeSubFiles()
      Write data from headers into separate files.
      • Methods inherited from class java.lang.Object

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

      • SpjFile

        public SpjFile​(java.io.File file)
    • Method Detail

      • numHeaders

        public int numHeaders()
        Number of headers present in the file.
        Returns:
        -1 if error
      • getComment

        public java.lang.String getComment()
      • getMapEntry

        public java.lang.String getMapEntry​(int i)
        Find the map entry (character string) that corresponds to a particular handle number.
        Parameters:
        i - handle index.
        Returns:
        string of map entry.
      • save

        public void save​(java.lang.String name)
                  throws java.io.IOException
        Save this file.

        It lays the file out again, changing the record start addresses into a sequential series.

        Parameters:
        name - file name.
        Throws:
        java.io.IOException - if anything goes wrong
      • read

        public void read()
                  throws java.io.IOException
        Read the file whose name was provided earlier.
        Throws:
        java.io.IOException - on file error.
      • writeSubFiles

        public void writeSubFiles()
                           throws java.io.IOException
        Write data from headers into separate files.

        Normally, we just work with the data within this file. This method allows us to extract the contents of the file for external use.

        Throws:
        java.io.IOException - on file error.
      • writeSubFile

        void writeSubFile​(int i,
                          java.lang.String name)
                   throws java.io.IOException
        Write the content from a specific header as a new "subfile".
        Parameters:
        i - index of the specific header
        name - filename
        Throws:
        java.io.IOException - based on underlying activity