Previous Next        Current Page: NeXtMidas Training / Primitives / Files in a Primitive / Getting Files
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   
   + Overview   
   + Open, Process, Close   
   + Building   
   + The NeXtMidas API   
   + Lab 1   
   + Special Variables   
   + Lab 2   
   + Lab 3*   
   - Files in a Primitive   
      - File Categories   
      - Getting Files   
      - Reading Frame-Based Data   
      - Writing Frame-Based Data   
      - Reading Record-Based Data   
      - Writing Record-Based Data   
      - A Note About Files   
   + Lab 4   
   + Lab 5*   
   + Test Macros   
   + Lab 6   
   + Real Time Controls   
   + Lab 7   
   + Working with Messages   
   + Lab 8   
   + Primitive Restarts   
   + Introduction to DSP   
   + Lab 9   
WebStart   
Maps & Imagery   
X-Midas Interoperability   
RMIF & Remoting   
Installing NeXtMidas   
Support & Maintenance   
File Handlers   


  • How to get a file from the command line.
    • Getting a file specified on the command line:
      MA.getFile(...) Gets a BaseFile (attempts to get specific subclass of BaseFile).
      MA.getBaseFile(...) Gets a BaseFile (does not attempt to get a specific subclass).
      MA.getDataFile(...) Gets a DataFile (Blue File).
      MA.getTextFile(...) Gets a TextFile.
    • Getting a file name specified on the command line:
      MA.getFileName(...) Gets a FileName.
  • How to get a file based on a file name.
    • Automatically resolve file type:
      • BaseFile.getInstanceFor(<ref>, <fileName>)
      • This will automatically try to resolve the file type (similar to MA.getFile(...)).
      • When called from a primitive, <ref> should usually be this.
      • When called from a library, <ref> should usually be a specific Midas context.
    • Do it manually:
      • Most of the file types have a constructor that takes in a <fileName> and a <ref>.
      • This will automatically try to resolve the file type (similar to MA.getFile(...)).
      • When called from a primitive, <ref> should usually be this.
      • When called from a library, <ref> should usually be a specific Midas context.
  • Get the file in the Primitive's open() method.
    • You must open the file before reading any data from it! e.g.
      inFile = MA.getFile("IN");
      inFile.open();

back