本文整理匯總了Java中org.apache.maven.shared.utils.io.IOUtil類的典型用法代碼示例。如果您正苦於以下問題:Java IOUtil類的具體用法?Java IOUtil怎麽用?Java IOUtil使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
IOUtil類屬於org.apache.maven.shared.utils.io包,在下文中一共展示了IOUtil類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: copyPluginResource
import org.apache.maven.shared.utils.io.IOUtil; //導入依賴的package包/類
private void copyPluginResource(File file) throws MojoExecutionException {
String name = file.getName();
try {
IOUtil.copy(getClass().getClassLoader().getResourceAsStream(name),
new FileOutputStream(file));
} catch (IOException e) {
throw new MojoExecutionException("could not copy from plugin: " + name, e);
}
}
示例2: pack
import org.apache.maven.shared.utils.io.IOUtil; //導入依賴的package包/類
@Override
public void pack( File source, File destination, Map<String, String> props, boolean gzip )
throws IOException
{
JarFile jar = null;
OutputStream out = null;
try
{
out = new FileOutputStream( destination );
if ( gzip )
{
out = new GZIPOutputStream( out )
{
{
def.setLevel( Deflater.BEST_COMPRESSION );
}
};
}
out = new BufferedOutputStream( out );
jar = new JarFile( source, false );
Pack200.Packer packer = Pack200.newPacker();
packer.properties().putAll( props );
packer.pack( jar, out );
}
finally
{
IOUtil.close( out );
if ( jar != null )
{
jar.close();
}
}
}
示例3: unpack
import org.apache.maven.shared.utils.io.IOUtil; //導入依賴的package包/類
@Override
public void unpack( File source, File destination, Map<String, String> props )
throws IOException
{
InputStream in = null;
JarOutputStream out = null;
try
{
in = new FileInputStream( source );
if ( isGzipped( source ) )
{
in = new GZIPInputStream( in );
}
in = new BufferedInputStream( in );
out = new JarOutputStream( new BufferedOutputStream( new FileOutputStream( destination ) ) );
Pack200.Unpacker unpacker = Pack200.newUnpacker();
unpacker.properties().putAll( props );
unpacker.unpack( in, out );
}
finally
{
IOUtil.close( in );
IOUtil.close( out );
}
}