Previous Next        Current Page: NeXtMidas Training / File Handlers / Lab 1 / Part 1 (ctd.)
back
Start Here   
Background   
Common Midas Concepts   
Getting Started - Part 1   
Getting Started - Part 2   
Working with Files   
Option Trees   
Macros - Part 1 (Basics)   
Macros - Part 2 (Graphics)   
NetBeans - Part 1 (Setup)   
NetBeans - Part 2 (GUIs)   
NetBeans - Part 3 (Profiler)   
Eclipse - Part 1 (Setup)   
Eclipse - Part 2 (GUIs)   
Primitives   
WebStart   
Maps & Imagery   
X-Midas Interoperability   
RMIF & Remoting   
Installing NeXtMidas   
Support & Maintenance   
File Handlers   
   + Introduction   
   - Lab 1   
      - File Format   
      - Part 1   
      - Part 1 (ctd.)   
      - Part 1 (ctd.)   
      - Part 2   
      - Part 3   
      - Part 4   
      - Solution   
   + Lab 2   


  • Part 1 - The File Header (continued):
    • Load the header (revisited)
      • Remember where we left those blank lines in setInternals()? Now we have the methods so we can fill them in.
      • If you look back a few pages you will see that the table that details the structure of the header also lists the default values. Just put calls to the set methods you created that will set these defaults.
    • Listing the header
      • Now lets override BaseFile's listHeader() method so that we can list the header for our file.
          public String listHeader() {
            return "OrangeFile  :  "+getURL()+"\n"
                 + "Size        :  "+getSize()+"\n"
                 + "Format      :  "+getFormat()+"\n"
                 + "XStart      :  "+getXStart()+"\n"
                 + "XDelta      :  "+getXDelta()+"\n";
          }
        
    • Trying it out
      • After building the class, we need to add an entry to the file handlers table that will tell NeXtMidas to use your new file handler when it sees an ORANGE file:
        nM> set REG.HANDLERS.FILE.ORANGE "nxm.train.lib.OrangeFile"
      • Save the sample file samplefile.orange to your local disk and status the file (size will be wrong, but we will fix that shortly).
        nM> status samplefile.orange
        OrangeFile  :  file:///home/student/samplefile.orange
        Size        :  16
        Format      :  SF
        XStart      :  0.0
        XDelta      :  1.0
        
    • Solution
      • After completing Part 1, your class will look similar to this.
  • continued on next page

back