当前位置: 首页>>代码示例>>Java>>正文


Java SmbFile.isDirectory方法代码示例

本文整理汇总了Java中jcifs.smb.SmbFile.isDirectory方法的典型用法代码示例。如果您正苦于以下问题:Java SmbFile.isDirectory方法的具体用法?Java SmbFile.isDirectory怎么用?Java SmbFile.isDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jcifs.smb.SmbFile的用法示例。


在下文中一共展示了SmbFile.isDirectory方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: performListing

import jcifs.smb.SmbFile; //导入方法依赖的package包/类
private Set<SmbFile> performListing(final SmbFile directory2, final boolean recurseSubdirectories) throws SmbException {
    if (!directory2.canRead() || !directory2.canWrite()) {
        throw new IllegalStateException("Directory '" + directory2 + "' does not have sufficient permissions (i.e., not writable and readable)");
    }
    final Set<SmbFile> queue = new HashSet<SmbFile>();
    if (!directory2.exists()) {
        return queue;
    }

    final SmbFile[] children = directory2.listFiles();
    if (children == null) {
        return queue;
    }

    for (final SmbFile child : children) {
        if (child.isDirectory()) {
            if (recurseSubdirectories) {
                queue.addAll(performListing(child,  recurseSubdirectories));
            }
        } else  {
            queue.add(child);
        }
    }

    return queue;
}
 
开发者ID:dream-lab,项目名称:echo,代码行数:27,代码来源:GetSmbFiles.java

示例2: listFiles

import jcifs.smb.SmbFile; //导入方法依赖的package包/类
public void listFiles() {
    try {
        NtlmPasswordAuthentication authentication = new NtlmPasswordAuthentication(
                null, USER, PASSWORD);
        SmbFile home = new SmbFile("smb://localhost:8445/user/", authentication);

        if(home.isDirectory()) {
            List<SmbFile> files = Arrays.asList(home.listFiles());
            for(SmbFile file: files) {
                if(file.isDirectory()) {
                    System.out.println("Directory: " + file.getName());
                }
                if(file.isFile()) {
                    System.out.println("File: " + file.getName());
                }
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:thebagchi,项目名称:heimdall-proxy,代码行数:22,代码来源:SambaTester.java

示例3: SmbFile2EncFSFileInfo

import jcifs.smb.SmbFile; //导入方法依赖的package包/类
private EncFSFileInfo SmbFile2EncFSFileInfo(SmbFile smbFile){
	EncFSFileInfo result;
	try {
		String name = smbFile.getName();
		
		//transform parent absolute path into path relative to server path 
		String relativePath=this.getRelativePathFromAbsolutePath(smbFile.getParent());
		
		
		if (name.endsWith("/")) name=name.substring(0,name.length()-1);
		result = new EncFSFileInfo(name,relativePath,smbFile.isDirectory(),smbFile.getLastModified(),smbFile.length(),true,true,true);
		
	} catch (Exception e){
		throw new RuntimeException(e);
	}
	
	return result;
}
 
开发者ID:starn,项目名称:encdroidMC,代码行数:19,代码来源:FileProvider3.java

示例4: compareTypes

import jcifs.smb.SmbFile; //导入方法依赖的package包/类
protected int compareTypes ( SmbFile f1, String f1name, SmbFile f2 ) throws IOException {
    String f2name, t1, t2;
    int i;

    if ( f1.isDirectory() != f2.isDirectory() ) {
        return f1.isDirectory() ? -1 : 1;
    }
    f2name = f2.getName();
    if ( f1.isDirectory() ) {
        return f1name.compareToIgnoreCase(f2name);
    }
    i = f1name.lastIndexOf('.');
    t1 = i == -1 ? "" : f1name.substring(i + 1);
    i = f2name.lastIndexOf('.');
    t2 = i == -1 ? "" : f2name.substring(i + 1);

    i = t1.compareToIgnoreCase(t2);
    if ( i == 0 ) {
        return f1name.compareToIgnoreCase(f2name);
    }
    return i;
}
 
开发者ID:AgNO3,项目名称:jcifs-ng,代码行数:23,代码来源:NetworkExplorer.java

示例5: compareSizes

import jcifs.smb.SmbFile; //导入方法依赖的package包/类
protected int compareSizes ( SmbFile f1, String f1name, SmbFile f2 ) throws IOException {
    long diff;

    if ( f1.isDirectory() != f2.isDirectory() ) {
        return f1.isDirectory() ? -1 : 1;
    }
    if ( f1.isDirectory() ) {
        return f1name.compareToIgnoreCase(f2.getName());
    }
    diff = f1.length() - f2.length();
    if ( diff == 0 ) {
        return f1name.compareToIgnoreCase(f2.getName());
    }
    return diff > 0 ? -1 : 1;
}
 
开发者ID:AgNO3,项目名称:jcifs-ng,代码行数:16,代码来源:NetworkExplorer.java

示例6: compareDates

import jcifs.smb.SmbFile; //导入方法依赖的package包/类
protected int compareDates ( SmbFile f1, String f1name, SmbFile f2 ) throws IOException {
    if ( f1.isDirectory() != f2.isDirectory() ) {
        return f1.isDirectory() ? -1 : 1;
    }
    if ( f1.isDirectory() ) {
        return f1name.compareToIgnoreCase(f2.getName());
    }
    return f1.lastModified() > f2.lastModified() ? -1 : 1;
}
 
开发者ID:AgNO3,项目名称:jcifs-ng,代码行数:10,代码来源:NetworkExplorer.java

示例7: isDirectory

import jcifs.smb.SmbFile; //导入方法依赖的package包/类
@Override
public boolean isDirectory(String srcPath) throws IOException {
	System.out.println("*** isDirectory "+getAbsolutePath(srcPath)+" => "+getAbsolutePath(srcPath));
	SmbFile currentFolder = new SmbFile(getAbsolutePath(srcPath), authentication);
	return currentFolder.isDirectory();
}
 
开发者ID:starn,项目名称:encdroidMC,代码行数:7,代码来源:FileProvider3.java

示例8: run

import jcifs.smb.SmbFile; //导入方法依赖的package包/类
public void run() {
            while( true ) {
                try {
                    DirEntry e;

                    synchronized( dirList ) {
                        while( dirList.isEmpty() ) {
//System.err.println( "workingThreads=" + workingThreads );
                            if( workingThreads == 0 ) {
                                return; // done
                            }
                            dirList.wait( 2000 );
                        }
                        e = (DirEntry)dirList.remove( 0 );
                        if( e.depth == 0 ) {
                            continue;
                        }
                        workingThreads++;
                    }

                    SmbFile[] l = e.dir.listFiles();

                    int n = maxDepth - e.depth;

                    for(int i = 0; l != null && i < l.length; i++ ) {
                        try {
                            sb.setLength( 0 );
                            for( int k = 0; k < n; k++ ) {
                                sb.append( "    " );
                            }
                            SmbFile d = l[i];
                            System.err.println( sb.append( d ));
                            if( d.isDirectory() ) {
                                synchronized( dirList ) {
                                    dirList.add( new DirEntry( d, e.depth - 1 ));
                                    dirList.notify();
                                }
                            }
                        } catch( IOException ioe ) {
                            ioe.printStackTrace();
                        }
                    }
                    synchronized( dirList ) {
                        workingThreads--;
                    }
                } catch( Exception x ) {
                    synchronized( dirList ) {
                        workingThreads--;
                    }
                    x.printStackTrace();
                }
            }
        }
 
开发者ID:codelibs,项目名称:jcifs,代码行数:54,代码来源:ThreadedSmbCrawler.java

示例9: compareNames

import jcifs.smb.SmbFile; //导入方法依赖的package包/类
protected int compareNames ( SmbFile f1, String f1name, SmbFile f2 ) throws IOException {
    if ( f1.isDirectory() != f2.isDirectory() ) {
        return f1.isDirectory() ? -1 : 1;
    }
    return f1name.compareToIgnoreCase(f2.getName());
}
 
开发者ID:AgNO3,项目名称:jcifs-ng,代码行数:7,代码来源:NetworkExplorer.java


注:本文中的jcifs.smb.SmbFile.isDirectory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。