Example usage for org.apache.commons.vfs2 Capability VIRTUAL

List of usage examples for org.apache.commons.vfs2 Capability VIRTUAL

Introduction

In this page you can find the example usage for org.apache.commons.vfs2 Capability VIRTUAL.

Prototype

Capability VIRTUAL

To view the source code for org.apache.commons.vfs2 Capability VIRTUAL.

Click Source Link

Document

A virtual filesystem can be an archive like tar or zip.

Usage

From source file:org.apache.commons.vfs2.example.Shell.java

private void info(String[] cmd) throws Exception {
    if (cmd.length > 1) {
        info(cmd[1]);/*from   ww w .j a v a2  s.  c o m*/
    } else {
        System.out.println("Default manager: \"" + mgr.getClass().getName() + "\" " + "version "
                + getVersion(mgr.getClass()));
        String[] schemes = mgr.getSchemes();
        List<String> virtual = new ArrayList<String>();
        List<String> physical = new ArrayList<String>();
        for (int i = 0; i < schemes.length; i++) {
            Collection<Capability> caps = mgr.getProviderCapabilities(schemes[i]);
            if (caps != null) {
                if (caps.contains(Capability.VIRTUAL) || caps.contains(Capability.COMPRESS)
                        || caps.contains(Capability.DISPATCHER)) {
                    virtual.add(schemes[i]);
                } else {
                    physical.add(schemes[i]);
                }
            }
        }
        if (!physical.isEmpty()) {
            System.out.println("  Provider Schemes: " + physical);
        }
        if (!virtual.isEmpty()) {
            System.out.println("   Virtual Schemes: " + virtual);
        }
    }
}

From source file:tain.kr.test.vfs.v01.Shell.java

private void info(String[] cmd) throws Exception {

    if (cmd.length > 1) {
        info(cmd[1]);//from  w w w .  j  av a2 s .  c om
    } else {
        System.out.println("Default manager: \"" + mgr.getClass().getName() + "\" " + "version "
                + getVersion(mgr.getClass()));

        String[] schemes = mgr.getSchemes();
        List<String> virtual = new ArrayList<String>();
        List<String> physical = new ArrayList<String>();

        for (int i = 0; i < schemes.length; i++) {
            Collection<Capability> caps = mgr.getProviderCapabilities(schemes[i]);
            if (caps != null) {
                if (caps.contains(Capability.VIRTUAL) || caps.contains(Capability.COMPRESS)
                        || caps.contains(Capability.DISPATCHER)) {
                    virtual.add(schemes[i]);
                } else {
                    physical.add(schemes[i]);
                }
            }
        }

        if (!physical.isEmpty()) {
            System.out.println("  Provider Schemes: " + physical);
        }

        if (!virtual.isEmpty()) {
            System.out.println("   Virtual Schemes: " + virtual);
        }
    }
}