當前位置: 首頁>>代碼示例>>Java>>正文


Java FileInfo.isDirectory方法代碼示例

本文整理匯總了Java中org.alfresco.jlan.server.filesys.FileInfo.isDirectory方法的典型用法代碼示例。如果您正苦於以下問題:Java FileInfo.isDirectory方法的具體用法?Java FileInfo.isDirectory怎麽用?Java FileInfo.isDirectory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.alfresco.jlan.server.filesys.FileInfo的用法示例。


在下文中一共展示了FileInfo.isDirectory方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getFileInformationInternal

import org.alfresco.jlan.server.filesys.FileInfo; //導入方法依賴的package包/類
private FileInfo getFileInformationInternal(SrvSession sess, TreeConnection tree,
        String path) throws IOException
{
           
    //String userName = AuthenticationUtil.getFullyAuthenticatedUser();
    SharedDevice device = tree.getSharedDevice();
    String deviceName = device.getName();
   
    if(logger.isDebugEnabled())
    {
        logger.debug("getFileInformation session:" + sess.getUniqueId() + ", deviceName:" + deviceName + ", path:" + path);
    }
    
    if(path == null)
    {
        throw new IllegalArgumentException("Path is null");
    }
    
    FileInfoKey key = new FileInfoKey(sess, path, tree);
    
    FileInfo fromCache = fileInfoCache.get(key);
    
    if(fromCache != null)
    {
        if(logger.isDebugEnabled())
        {
            logger.debug("returning FileInfo from cache");
        }
        return fromCache;
    }
    
    FileInfo info = diskInterface.getFileInformation(sess, tree, path);
    
    if(info != null)
    {
        /**
         * Don't cache directories since the modification date is important.
         */
        if(!info.isDirectory())
        {
            fileInfoCache.put(key, info);
        }
    }
     
    /*
     * Dual Key the cache so it can be looked up by NodeRef or Path
     */
    if(info instanceof ContentFileInfo)
    {
        ContentFileInfo cinfo = (ContentFileInfo)info;
        fileInfoCache.put(cinfo.getNodeRef(), info);    
    }
    
    return info;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:56,代碼來源:BufferedContentDiskDriver.java

示例2: fileExists

import org.alfresco.jlan.server.filesys.FileInfo; //導入方法依賴的package包/類
@Override
public int fileExists(SrvSession sess, TreeConnection tree, String path)
{
    String deviceName = tree.getSharedDevice().getName();
    
    if(logger.isDebugEnabled())
    {
        logger.debug("fileExists session:" + sess.getUniqueId() + ", deviceName" + deviceName + ", path:" + path);
    }
    
    FileInfoKey key = new FileInfoKey(sess, path, tree);
    
    FileInfo fromCache = fileInfoCache.get(key);
    
    if(fromCache != null)
    {
        if(logger.isDebugEnabled())
        {
            logger.debug("fileExists found FileInfo in cache");
        }
        if (fromCache.isDirectory())
        {
            return FileStatus.DirectoryExists;
        }
        else
        {
            return FileStatus.FileExists;
        }
    }
    else
    {
        try 
        {
            FileInfo lookup = getFileInformationInternal(sess, tree, path);
            
            if(logger.isDebugEnabled())
            {
                logger.debug("fileExists obtained file information");
            }
            if (lookup.isDirectory())
            {
                return FileStatus.DirectoryExists;
            }
            else
            {
                return FileStatus.FileExists;
            }
        }
        catch (IOException ie)
        {
            return FileStatus.NotExist;
        }
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:55,代碼來源:BufferedContentDiskDriver.java


注:本文中的org.alfresco.jlan.server.filesys.FileInfo.isDirectory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。