Example usage for org.apache.commons.vfs2.provider.bzip2 Bzip2FileObject wrapInputStream

List of usage examples for org.apache.commons.vfs2.provider.bzip2 Bzip2FileObject wrapInputStream

Introduction

In this page you can find the example usage for org.apache.commons.vfs2.provider.bzip2 Bzip2FileObject wrapInputStream.

Prototype

public static InputStream wrapInputStream(final String name, final InputStream is) throws IOException 

Source Link

Usage

From source file:org.ysb33r.groovy.vfsplugin.cpio.CpioFileSystem.java

protected CpioArchiveInputStream createCpioFile(final File file) throws FileSystemException {
    try {/*from w w  w. j ava 2s . c om*/
        if ("cpiogz".equalsIgnoreCase(getRootName().getScheme())) {
            return new CpioArchiveInputStream(new GZIPInputStream(new FileInputStream(file)));
        } else if ("cpiobz2".equalsIgnoreCase(getRootName().getScheme())) {
            return new CpioArchiveInputStream(
                    Bzip2FileObject.wrapInputStream(file.getAbsolutePath(), new FileInputStream(file)));
        }
        return new CpioArchiveInputStream(new FileInputStream(file));
    } catch (final IOException ioe) {
        throw new FileSystemException("vfs.provider.Cpio/open-Cpio-file.error", file, ioe);
    }
}