Search in sources :

Example 1 with LazyFileContentInputStream

use of org.apache.jackrabbit.vfs.ext.ds.LazyFileContentInputStream in project jackrabbit by apache.

the class VFSFileSystem method getInputStream.

@Override
public InputStream getInputStream(String filePath) throws FileSystemException {
    try {
        final FileObject fo = resolveFileObject(filePath);
        final FileObject folder = fo.getParent();
        if (!folder.exists() || !folder.isFolder()) {
            throw new FileSystemException("Folder doesn't exist for " + filePath + ".");
        }
        return new LazyFileContentInputStream(fo);
    } catch (org.apache.commons.vfs2.FileSystemException e) {
        final String msg = "Failed to open an input stream from " + filePath + ".";
        log.debug(msg, e);
        throw new FileSystemException(msg, e);
    }
}
Also used : FileSystemException(org.apache.jackrabbit.core.fs.FileSystemException) LazyFileContentInputStream(org.apache.jackrabbit.vfs.ext.ds.LazyFileContentInputStream) FileObject(org.apache.commons.vfs2.FileObject)

Aggregations

FileObject (org.apache.commons.vfs2.FileObject)1 FileSystemException (org.apache.jackrabbit.core.fs.FileSystemException)1 LazyFileContentInputStream (org.apache.jackrabbit.vfs.ext.ds.LazyFileContentInputStream)1