/** * Replace with the default pattern of <code>${var}</code> * * @param string * the string which should be processed, may be <code>null</code> * @param properties * the properties used for replacing * @return the source string with patterns replaced */ public static String replace ( final String string, final Map<?, ?> properties ) { return replace ( string, newSource ( properties ), DEFAULT_PATTERN ); }
public static ContentProvider createContent ( final InputStream resource, final Map<String, String> replacements, final Pattern pattern ) throws IOException { try { String str = CharStreams.toString ( new InputStreamReader ( resource, StandardCharsets.UTF_8 ) ); str = StringReplacer.replace ( str, StringReplacer.newSource ( replacements ), pattern ); return new StaticContentProvider ( str ); } finally { resource.close (); } }
protected static void createFile ( final File file, final InputStream resource, final Map<String, String> replacements, final IProgressMonitor monitor, final Pattern pattern ) throws Exception { try { String str = CharStreams.toString ( new InputStreamReader ( resource, StandardCharsets.UTF_8 ) ); str = StringReplacer.replace ( str, StringReplacer.newSource ( replacements ), pattern ); createFile ( file, str, monitor ); } finally { resource.close (); } }
public static ContentProvider createContent ( final InputStream resource, final Map<String, String> replacements, final Pattern pattern ) throws IOException { try { String str = CharStreams.toString ( CharStreams.newReaderSupplier ( new InputSupplier<InputStream> () { @Override public InputStream getInput () throws IOException { return resource; } }, Charset.forName ( "UTF-8" ) ) ); //$NON-NLS-1$ str = StringReplacer.replace ( str, StringReplacer.newSource ( replacements ), pattern ); return new StaticContentProvider ( str ); } finally { resource.close (); } }
protected static void createFile ( final File file, final InputStream resource, final Map<String, String> replacements, final IProgressMonitor monitor, final Pattern pattern ) throws Exception { try { String str = CharStreams.toString ( CharStreams.newReaderSupplier ( new InputSupplier<InputStream> () { @Override public InputStream getInput () throws IOException { return resource; } }, Charset.forName ( "UTF-8" ) ) ); str = StringReplacer.replace ( str, StringReplacer.newSource ( replacements ), pattern ); createFile ( file, str, monitor ); } finally { resource.close (); } }