|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK 11g Release 2 (11.1.2.2.0) E17493-03 |
|||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
Provides macro expansion for Strings, Files, and Streams (Reader/Writer).
See:
Description
Interface Summary | |
---|---|
MacroConverter |
Class Summary | |
---|---|
FileMacroConverter | FileMacroConverter - converts macros a file at a time. |
StringMacroConverter | StringMacroConverter - converts macros in a String. |
Provides macro expansion for Strings, Files, and Streams (Reader/Writer).
Package Specification.
The macro classes consist of two converters.
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 11g Release 2 (11.1.2.2.0) E17493-03 |
|||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |