本文整理汇总了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();
}
}
示例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);
}
}
示例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() );
}
}
}