当前位置: 首页>>代码示例>>Java>>正文


Java RawInputStreamFacade类代码示例

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


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

示例1: copyResources

import org.codehaus.plexus.util.io.RawInputStreamFacade; //导入依赖的package包/类
private void copyResources(String resourcePath, String path) throws IOException {
    ClassLoader cl = getClass().getClassLoader();
    InputStream indexStream = cl.getResourceAsStream(resourcePath + ".index");
    try {
        List<String> names = IOUtils.readLines(indexStream, UTF8);
        for (String name : names) {
            InputStream stream = cl.getResourceAsStream(resourcePath + name);
            try {
                FileUtils.copyStreamToFile(new RawInputStreamFacade(stream),
                                           new File(getTargetFolder(), path + "/" + name));
            } finally {
                stream.close();
            }
        }
    } finally {
        indexStream.close();
    }
}
 
开发者ID:Kadvin,项目名称:spring-component-framework,代码行数:19,代码来源:SpringComponentPackaging.java

示例2: copySigarLibs

import org.codehaus.plexus.util.io.RawInputStreamFacade; //导入依赖的package包/类
private void copySigarLibs(final File libDirectory, File sigarDistributionFile)
        throws MojoExecutionException {
    try {
        ZipUtil.iterate(sigarDistributionFile, new ZipEntryCallback() {
            @Override
            public void process(InputStream in, ZipEntry zipEntry) throws IOException {
                String zipEntryName = zipEntry.getName();
                if (zipEntryName.contains("sigar-bin/lib") && !zipEntryName.endsWith("/")) {
                    String compressedFileName = zipEntryName.substring(zipEntryName.lastIndexOf("/") + 1);
                    if (compressedFileName.endsWith(".so") || compressedFileName.endsWith(".dll") ||
                            compressedFileName.endsWith(".sl") || compressedFileName.endsWith(".dylib")
                            || compressedFileName.equals("sigar.jar")) {
                        File destinationFile = new File(libDirectory, compressedFileName);
                        copyStreamToFile(new RawInputStreamFacade(in), destinationFile);
                    }
                }
            }
        });
    } catch (Exception e) {
        throw new MojoExecutionException("Could not unpack Sigar file " + sigarDistributionFile
                .getAbsolutePath(), e);
    }
}
 
开发者ID:rhq-project,项目名称:rhq-agent-plugin-plugin,代码行数:24,代码来源:SetupTestPluginContainerMojo.java

示例3: expandArchive

import org.codehaus.plexus.util.io.RawInputStreamFacade; //导入依赖的package包/类
protected void expandArchive( Archiver archiver, File destDirectory )
    throws IOException
{
    for ( ResourceIterator iter = archiver.getResources(); iter.hasNext(); )
    {
        ArchiveEntry entry = iter.next();
        String name = entry.getName();
        name = name.replace( File.separatorChar, '/' );
        File destFile = new File( destDirectory, name );

        switch ( entry.getType() )
        {
            case ArchiveEntry.DIRECTORY:
                if ( !destFile.exists() )
                {
                    getLog().debug( "adding directory " + name + '/' );
                    if ( !destFile.mkdirs() )
                    {
                        throw new IOException( "Unable to create directory: " + destFile );
                    }
                }
                break;
            case ArchiveEntry.FILE:
                PlexusIoResource resource = entry.getResource();
                boolean skip = false;
                if ( !destFile.exists() )
                {
                    getLog().debug( "adding file " + name );
                }
                else
                {
                    long resLastModified = resource.getLastModified();
                    if ( resLastModified != PlexusIoResource.UNKNOWN_MODIFICATION_DATE )
                    {
                        long destFileLastModified = destFile.lastModified();
                        if ( resLastModified <= destFileLastModified )
                        {
                            skip = true;
                        }
                        else
                        {
                            getLog().debug( "updating file " + name );
                        }
                    }
                }
                if ( !skip )
                {
                    InputStream contents = resource.getContents();
                    RawInputStreamFacade facade = new RawInputStreamFacade( contents );
                    FileUtils.copyStreamToFile( facade, destFile );
                }
                break;
            default:
                throw new ArchiverException( "Unknown archive entry type: " + entry.getType() );
        }
    }
}
 
开发者ID:play1-maven-plugin,项目名称:play1-maven-plugin,代码行数:58,代码来源:AbstractArchivingMojo.java


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