Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
12c (12.1.3)

E41664-01

Package oracle.ide.util.macro

Provides macro expansion for Strings, Files, and Streams (Reader/Writer).

See: Description

Package oracle.ide.util.macro Description

Provides macro expansion for Strings, Files, and Streams (Reader/Writer).

Package Specification.

The macro classes consist of two converters.

  1. StringMacroCoverter - Used to expand the macros in a single String.
  2. FileMacroConverter - Used to expand the macros in a File, either directly or via a Writer to the file.

Related Documentation

Example Usages:

String usage:


    public void StringTest3()
    {
      StringMacroConverter filter =
          StringMacroConverter.getConverter(MacroConverter.MAKE_CONVERTER);
      String orig = "Your OS is $(os.name), running on an $(os.arch) cpu.";
      String news = filter.expandString(orig, System.getProperties());
      System.out.println(news);
    }

File usage:



    public void FileTest1() throws Exception
    {
      FileMacroConverter filter =
        FileMacroConverter.getConverter(MacroConverter.AT_CONVERTER);

      File sourceFile = new File("C:\\src.txt");
      String text = "Your OS is @os.name@, running on an @os.arch@ cpu.";
      createTempFile(sourceFile, text);

      File destFile = new File("C:\\dest.txt");
      if (destFile.exists())
      {
        destFile.delete();
      }
      filter.expandFile(sourceFile, destFile, System.getProperties());
    }

    private void createTempFile(File sourceFile, String text) throws Exception
    {
      if (sourceFile.exists())
      {
        sourceFile.delete();
      }
      sourceFile.createNewFile();
      FileOutputStream fos = new FileOutputStream(sourceFile);
      fos.write(text.getBytes());
      fos.close();
    }

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
12c (12.1.3)

E41664-01

Copyright © 1997, 2014, Oracle. All rights reserved.