• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java InterpolationFilterReader类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.codehaus.plexus.util.InterpolationFilterReader的典型用法代码示例。如果您正苦于以下问题:Java InterpolationFilterReader类的具体用法?Java InterpolationFilterReader怎么用?Java InterpolationFilterReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



InterpolationFilterReader类属于org.codehaus.plexus.util包,在下文中一共展示了InterpolationFilterReader类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: interpolateBaseDirAndRepo

import org.codehaus.plexus.util.InterpolationFilterReader; //导入依赖的package包/类
private String interpolateBaseDirAndRepo( String content )
{
    StringReader sr = new StringReader( content );
    StringWriter result = new StringWriter();

    Map context = new HashMap();

    context.put( "BASEDIR", StringUtils.quoteAndEscape( getBasedir(), '"' ) );
    context.put( "REPO", StringUtils.quoteAndEscape( getRepo(), '"' ) );
    InterpolationFilterReader interpolationFilterReader = new InterpolationFilterReader( sr, context, "@", "@" );
    try
    {
        IOUtil.copy( interpolationFilterReader, result );
    }
    catch ( IOException e )
    {
        // shouldn't happen...
    }
    return result.toString();
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:21,代码来源:Platform.java


示例2: interpolateBaseDirAndRepo

import org.codehaus.plexus.util.InterpolationFilterReader; //导入依赖的package包/类
private String interpolateBaseDirAndRepo( String content )
{
    StringReader sr = new StringReader( content );
    StringWriter result = new StringWriter();

    Map<Object, Object> context = new HashMap<Object, Object>();

    context.put( "BASEDIR", StringUtils.quoteAndEscape( getBasedir(), '"' ) );
    context.put( "REPO", StringUtils.quoteAndEscape( getRepo(), '"' ) );
    InterpolationFilterReader interpolationFilterReader = new InterpolationFilterReader( sr, context, "@", "@" );
    try
    {
        IOUtil.copy( interpolationFilterReader, result );
    }
    catch ( IOException e )
    {
        // shouldn't happen...
    }
    return result.toString();
}
 
开发者ID:mojohaus,项目名称:appassembler,代码行数:21,代码来源:Platform.java


示例3: writeFilteredFile

import org.codehaus.plexus.util.InterpolationFilterReader; //导入依赖的package包/类
private static void writeFilteredFile( DaemonGenerationRequest request, Daemon daemon, Reader reader,
                                       File outputFile, Map context )
    throws DaemonGeneratorException
{
    InterpolationFilterReader interpolationFilterReader = new InterpolationFilterReader( reader, context, "@", "@" );

    writeFile( outputFile, interpolationFilterReader );
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:9,代码来源:JavaServiceWrapperDaemonGenerator.java


示例4: createFilteredFile

import org.codehaus.plexus.util.InterpolationFilterReader; //导入依赖的package包/类
protected File createFilteredFile( String file )
    throws IOException, FileNotFoundException, DaemonGeneratorException, XmlPullParserException
{
    String version = getAppAssemblerBooterVersion();
    Properties context = new Properties();
    context.setProperty( "appassembler.version", version );

    File tempPom = File.createTempFile( "appassembler", "tmp" );
    tempPom.deleteOnExit();

    InterpolationFilterReader reader =
        new InterpolationFilterReader( new FileReader( getTestFile( file ) ), context, "@", "@" );
    FileWriter out = null;

    try
    {
        out = new FileWriter( tempPom );

        IOUtil.copy( reader, out );
    }
    catch ( IOException e )
    {
        throw new DaemonGeneratorException( "Error writing output file: " + tempPom.getAbsolutePath(), e );
    }
    finally
    {
        IOUtil.close( reader );
        IOUtil.close( out );
    }
    return tempPom;
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:32,代码来源:AbstractDaemonGeneratorTest.java


示例5: writeFilteredFile

import org.codehaus.plexus.util.InterpolationFilterReader; //导入依赖的package包/类
private static void writeFilteredFile( DaemonGenerationRequest request, Daemon daemon, Reader reader,
                                       File outputFile, Map context )
                                           throws DaemonGeneratorException
{
    InterpolationFilterReader interpolationFilterReader =
        new InterpolationFilterReader( reader, context, "@", "@" );

    writeFile( outputFile, interpolationFilterReader );
}
 
开发者ID:mojohaus,项目名称:appassembler,代码行数:10,代码来源:JavaServiceWrapperDaemonGenerator.java


示例6: filterCopy

import org.codehaus.plexus.util.InterpolationFilterReader; //导入依赖的package包/类
private void filterCopy( File sourceFile, String resourcePath, File destinationFile, Properties filterProperties )
    throws IOException
{
    // buffer so it isn't reading a byte at a time!
    Reader source = null;
    Writer destination = null;
    try
    {
        InputStream instream;
        if ( sourceFile != null )
        {
            instream = new FileInputStream( sourceFile );
        }
        else
        {
            instream = getClass().getClassLoader().getResourceAsStream( resourcePath );
        }
        FileOutputStream outstream = new FileOutputStream( destinationFile );

        source = new BufferedReader( new InputStreamReader( instream, "UTF-8" ) );
        destination = new OutputStreamWriter( outstream, "UTF-8" );

        // support ${token}
        Reader reader = new InterpolationFilterReader( source, filterProperties, "${", "}" );

        IOUtil.copy( reader, destination );
    }
    finally
    {
        IOUtil.close( source );
        IOUtil.close( destination );
    }
}
 
开发者ID:bitstrings,项目名称:nbm-maven,代码行数:34,代码来源:CreateWebstartAppMojo.java


示例7: interpolate

import org.codehaus.plexus.util.InterpolationFilterReader; //导入依赖的package包/类
private static String interpolate(Map<String, String> dict, String value) {
    if (value == null) {
        return null;
    }

    for (;;) {
        if (!value.contains("${")) {
            // Nothing to interpolate.
            break;
        }

        InterpolationFilterReader reader = new InterpolationFilterReader(new StringReader(value), dict);
        StringWriter writer = new StringWriter(value.length());
        for (;;) {
            int ch;
            try {
                ch = reader.read();
            } catch (IOException e) {
                // Should not reach here.
                throw (Error) new Error().initCause(e);
            }

            if (ch == -1) {
                break;
            }
            writer.write(ch);
        }

        String newValue = writer.toString();
        if (value.equals(newValue)) {
            // No interpolatable prpoerties left.
            break;
        }

        // Interpolated at least one variable.
        // Try again just in case the interpolation introduced another variable.
        value = newValue;
    }

    return value;
}
 
开发者ID:trustin,项目名称:os-maven-plugin,代码行数:42,代码来源:DetectExtension.java



注:本文中的org.codehaus.plexus.util.InterpolationFilterReader类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ExecutionEnvironment类代码示例发布时间:2022-05-23
下一篇:
Java DocumentOnTypeFormattingParams类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap