• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java AbstractFileSystem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.commons.vfs2.provider.AbstractFileSystem的典型用法代码示例。如果您正苦于以下问题:Java AbstractFileSystem类的具体用法?Java AbstractFileSystem怎么用?Java AbstractFileSystem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AbstractFileSystem类属于org.apache.commons.vfs2.provider包,在下文中一共展示了AbstractFileSystem类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: MimeFileObject

import org.apache.commons.vfs2.provider.AbstractFileSystem; //导入依赖的package包/类
protected MimeFileObject(final AbstractFileName name,
                        final Part part,
                        final AbstractFileSystem fileSystem) throws FileSystemException
{
    super(name, fileSystem);
    setPart(part);
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:8,代码来源:MimeFileObject.java


示例2: fireAllCreate

import org.apache.commons.vfs2.provider.AbstractFileSystem; //导入依赖的package包/类
/**
 * Recursively fires create events for all children if recursive descent is
 * enabled. Otherwise the create event is only fired for the initial
 * FileObject.
 * @param child The child to add.
 */
private void fireAllCreate(FileObject child)
{
    // Add listener so that it can be triggered
    if (this.fm.getFileListener() != null)
    {
        child.getFileSystem().addListener(child, this.fm.getFileListener());
    }

    ((AbstractFileSystem) child.getFileSystem()).fireFileCreated(child);

    // Remove it because a listener is added in the queueAddFile
    if (this.fm.getFileListener() != null)
    {
        child.getFileSystem().removeListener(child,
            this.fm.getFileListener());
    }

    this.fm.queueAddFile(child); // Add

    try
    {

        if (this.fm.isRecursive())
        {
            if (child.getType().hasChildren())
            {
                FileObject[] newChildren = child.getChildren();
                for (int i = 0; i < newChildren.length; i++)
                {
                    fireAllCreate(newChildren[i]);
                }
            }
        }

    }
    catch (FileSystemException fse)
    {
        LOG.error(fse.getLocalizedMessage(), fse);
    }
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:47,代码来源:DefaultFileMonitor.java


示例3: check

import org.apache.commons.vfs2.provider.AbstractFileSystem; //导入依赖的package包/类
private void check()
{
    this.refresh();

    try
    {
        // If the file existed and now doesn't
        if (this.exists && !this.file.exists())
        {
            this.exists = this.file.exists();
            this.timestamp = -1;

            // Fire delete event

            ((AbstractFileSystem)
                this.file.getFileSystem()).fireFileDeleted(this.file);

            // Remove listener in case file is re-created. Don't want to fire twice.
            if (this.fm.getFileListener() != null)
            {
                this.file.getFileSystem().removeListener(this.file,
                    this.fm.getFileListener());
            }

            // Remove from map
            this.fm.queueRemoveFile(this.file);
        }
        else if (this.exists && this.file.exists())
        {

            // Check the timestamp to see if it has been modified
            if (this.timestamp != this.file.getContent().getLastModifiedTime())
            {
                this.timestamp = this.file.getContent().getLastModifiedTime();
                // Fire change event

                // Don't fire if it's a folder because new file children
                // and deleted files in a folder have their own event triggered.
                if (!this.file.getType().hasChildren())
                {
                    ((AbstractFileSystem)
                        this.file.getFileSystem()).fireFileChanged(this.file);
                }
            }

        }
        else if (!this.exists && this.file.exists())
        {
            this.exists = this.file.exists();
            this.timestamp = this.file.getContent().getLastModifiedTime();
            // Don't fire if it's a folder because new file children
            // and deleted files in a folder have their own event triggered.
            if (!this.file.getType().hasChildren())
            {
                ((AbstractFileSystem)
                        this.file.getFileSystem()).fireFileCreated(this.file);
            }
        }

        this.checkForNewChildren();

    }
    catch (FileSystemException fse)
    {
        LOG.error(fse.getLocalizedMessage(), fse);
    }
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:68,代码来源:DefaultFileMonitor.java


示例4: runTest

import org.apache.commons.vfs2.provider.AbstractFileSystem; //导入依赖的package包/类
/**
     * Runs the test.  This implementation short-circuits the test if the
     * provider being tested does not have the capabilities required by this
     * test.
     *
     * @todo Handle negative caps as well - ie, only run a test if the provider does not have certain caps.
     * @todo Figure out how to remove the test from the TestResult if the test is skipped.
     */
    @Override
    protected void runTest() throws Throwable
    {
        // Check the capabilities
        final Capability[] caps = getRequiredCaps();
        if (caps != null)
        {
            for (int i = 0; i < caps.length; i++)
            {
                final Capability cap = caps[i];
                FileSystem fs = readFolder.getFileSystem();
                if (!fs.hasCapability(cap))
                {
//                    String name = fs.getClass().getName();
//                    int index = name.lastIndexOf('.');
//                    String fsName = (index > 0) ? name.substring(index + 1) : name;
//                    System.out.println("skipping " + getName() + " because " +
//                        fsName + " does not have capability " + cap);
                    return;
                }
            }
        }

        // Provider has all the capabilities - execute the test
        if (method != null)
        {
            try
            {
                method.invoke(this, (Object[]) null);
            }
            catch (final InvocationTargetException e)
            {
                throw e.getTargetException();
            }
        }
        else
        {
            super.runTest();
        }

        if (((AbstractFileSystem) readFolder.getFileSystem()).isOpen())
        {
            String name = "unknown";
            if (method != null)
            {
                name = method.getName();
            }

            throw new IllegalStateException(getClass().getName() + ": filesystem has open streams after: " + name);
        }
    }
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:60,代码来源:AbstractProviderTestCase.java



注:本文中的org.apache.commons.vfs2.provider.AbstractFileSystem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java VirtualFileWrapper类代码示例发布时间:2022-05-22
下一篇:
Java Authentication类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap