Example usage for org.apache.commons.vfs.impl DefaultFileSystemManager getTemporaryFileStore

List of usage examples for org.apache.commons.vfs.impl DefaultFileSystemManager getTemporaryFileStore

Introduction

In this page you can find the example usage for org.apache.commons.vfs.impl DefaultFileSystemManager getTemporaryFileStore.

Prototype

public TemporaryFileStore getTemporaryFileStore() throws FileSystemException 

Source Link

Document

Returns the temporary file store.

Usage

From source file:org.sonatype.gshell.vfs.provider.truezip.TruezipFileObject.java

/**
 * Attaches this file object to its file resource.
 *//*from   w w  w .  j a v a2s .c o m*/
protected void doAttach() throws Exception {
    if (file == null) {
        LayeredFileName layeredFileName = (LayeredFileName) getName();
        String fileName = layeredFileName.getOuterName().getRootURI()
                + layeredFileName.getOuterName().getPathDecoded();

        FileObject outer = getFileSystem().resolveFile(fileName);
        if (outer instanceof TruezipFileObject) {
            fileName = layeredFileName.getOuterName().getPathDecoded() + getName().getPathDecoded();
            file = new File(fileName, ArchiveDetector.ALL);
        } else {
            fileObject = outer;
            DefaultFileSystemManager dfsMgr = (DefaultFileSystemManager) VFS.getManager();
            file = new File(dfsMgr.getTemporaryFileStore().allocateFile(getName().getBaseName()));
        }
    }
}