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


Java SmbFile.listFiles方法代码示例

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


在下文中一共展示了SmbFile.listFiles方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: fsList

import jcifs.smb.SmbFile; //导入方法依赖的package包/类
@Override
public List<EncFSFileInfo> fsList(String path) throws IOException {
	System.out.println("*** fsList "+path+" => "+getAbsolutePath(path));
	String pathToList = getAbsolutePath(path);
	if (!pathToList.endsWith("/")) pathToList+="/";
	SmbFile currentFolder = new SmbFile(pathToList, authentication);
	SmbFile[] files = currentFolder.listFiles();
       List<EncFSFileInfo> fList = new LinkedList<EncFSFileInfo>();
       for(int a = 0; a < files.length; a++)
       {
       	EncFSFileInfo encFSFileInfo = SmbFile2EncFSFileInfo(files[a]);
           fList.add(encFSFileInfo);
       }

       return fList;
}
 
开发者ID:starn,项目名称:encdroidMC,代码行数:17,代码来源:FileProvider3.java

示例3: traverse

import jcifs.smb.SmbFile; //导入方法依赖的package包/类
void traverse( SmbFile f, int depth ) throws MalformedURLException, IOException {

        if( depth == 0 ) {
            return;
        }

        SmbFile[] l = f.listFiles();

        for(int i = 0; l != null && i < l.length; i++ ) {
            try {
                for( int j = maxDepth - depth; j > 0; j-- ) {
                    System.out.print( "    " );
                }
                System.out.println( l[i] + " " + l[i].exists() );
                if( l[i].isDirectory() ) {
                    traverse( l[i], depth - 1 );
                }
            } catch( IOException ioe ) {
                System.out.println( l[i] + ":" );
                ioe.printStackTrace( System.out );
            }
        }
    }
 
开发者ID:codelibs,项目名称:jcifs,代码行数:24,代码来源:CrawlTest.java

示例4: main

import jcifs.smb.SmbFile; //导入方法依赖的package包/类
public static void main( String argv[] ) throws Exception
{
    if (argv.length < 2) {
        System.err.println("usage: TestListLoop <smburl> <count>");
        System.exit(0);
    }

    int count = Integer.parseInt(argv[1]);

    for ( ;; ) {
        try {
            SmbFile f = new SmbFile(argv[0]);
            SmbFile[] list = f.listFiles();
            System.out.println("Successfully listed resource: " + list.length);
        } catch (SmbException se) {
            se.printStackTrace();
        }

        if (--count <= 0)
            break;

        Thread.sleep( 1000 );
    }
}
 
开发者ID:codelibs,项目名称:jcifs,代码行数:25,代码来源:TestListLoop.java

示例5: jcifsScan

import jcifs.smb.SmbFile; //导入方法依赖的package包/类
public static void jcifsScan(String root, int sleepTime) throws Exception {
    long start = System.currentTimeMillis();
    SmbFile smbRoot = new SmbFile(root);
    SmbFile[] files = smbRoot.listFiles();
    for(SmbFile f : files) {
        System.out.println( f + ": " + f.canRead()+" : "+ f.length() + ": " + (System.currentTimeMillis()-start));
    Thread.sleep(sleepTime);
    }
}
 
开发者ID:codelibs,项目名称:jcifs,代码行数:10,代码来源:SmbTimeout.java

示例6: main

import jcifs.smb.SmbFile; //导入方法依赖的package包/类
public static void main( String[] argv ) throws Exception {

        SmbFile file = new SmbFile( argv[0] );

        long t1 = System.currentTimeMillis();
        SmbFile[] files = file.listFiles();
        long t2 = System.currentTimeMillis() - t1;

        for( int i = 0; i < files.length; i++ ) {
            System.out.print( " " + files[i].getName() );
            switch(files[i].getType()) {
                case SmbFile.TYPE_FILESYSTEM:
                    System.out.println( "[TYPE_FILESYSTEM]" );
                    break;
                case SmbFile.TYPE_WORKGROUP:
                    System.out.println( "[TYPE_WORKGROUP]" );
                    break;
                case SmbFile.TYPE_SERVER:
                    System.out.println( "[TYPE_SERVER]" );
                    break;
                case SmbFile.TYPE_SHARE:
                    System.out.println( "[TYPE_SHARE]" );
                    break;
                case SmbFile.TYPE_NAMED_PIPE:
                    System.out.println( "[TYPE_NAMEDPIPE]" );
                    break;
                case SmbFile.TYPE_PRINTER:
                    System.out.println( "[TYPE_PRINTER]" );
                    break;
                case SmbFile.TYPE_COMM:
                    System.out.println( "[TYPE_COMM]" );
                    break;
            };
        }
        System.out.println( files.length + " files in " + t2 + "ms" );
    }
 
开发者ID:codelibs,项目名称:jcifs,代码行数:37,代码来源:ListTypes.java

示例7: listDirs

import jcifs.smb.SmbFile; //导入方法依赖的package包/类
/**
 * 디렉토리 목록 조회
 * 
 * @param sbmFile
 * @return
 * @throws Exception
 */
public static SmbFile[] listDirs(SmbFile sbmFile) throws Exception {
	return sbmFile.listFiles(new SmbFileFilter() {
		public boolean accept(SmbFile arg0) throws SmbException {
			return arg0.isDirectory();
		}
	});
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:15,代码来源:NetBiosTest.java

示例8: listFile

import jcifs.smb.SmbFile; //导入方法依赖的package包/类
/**
 * 디렉토리 목록 조회
 * 
 * @param sbmFile
 * @return
 * @throws Exception
 */
public static SmbFile[] listFile(SmbFile sbmFile) throws Exception {
	return sbmFile.listFiles(new SmbFileFilter() {
		public boolean accept(SmbFile arg0) throws SmbException {
			return arg0.isFile();
		}
	});
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:15,代码来源:NetBiosTest.java

示例9: main

import jcifs.smb.SmbFile; //导入方法依赖的package包/类
public static void main(String[] args) throws LoginException {
    if(args.length != 5){
        help();
        return;
    }
    NAME = args[0];
    PWD = args[1];
    URL = args[2];
    KDC = args[3];
    REALM = args[4];

    Config.setProperty("jcifs.smb.client.capabilities",Kerb5Authenticator.CAPABILITIES);
    Config.setProperty("jcifs.smb.client.flags2",Kerb5Authenticator.FLAGS2);
    Config.setProperty("jcifs.smb.client.signingPreferred", "true");
    try {
        // login
        Subject subject = new Subject();
        login(subject);

        // list file
        SmbFile file = new SmbFile(URL, new Kerb5Authenticator(subject));
        SmbFile[] files = file.listFiles();
        for( int i = 0; i < files.length; i++ ) {
            System.out.println( "-->" + files[i].getName() );
            System.out.println("DFS path: " + files[i].getDfsPath());
        }

    } catch (Exception e) {
        e.printStackTrace();
    } 
}
 
开发者ID:jaeksoft,项目名称:jcifs-krb5,代码行数:32,代码来源:KerberosAuthExample.java

示例10: main

import jcifs.smb.SmbFile; //导入方法依赖的package包/类
public static void main( String[] argv ) throws Exception {

        for (int a = 0; a < argv.length; a++) {
            SmbFile file = new SmbFile( argv[a], NtlmPasswordAuthentication.ANONYMOUS );
            SmbFile[] files = file.listFiles();
            for( int i = 0; i < files.length; i++ ) {
                System.out.print( " " + files[i].getName() );
            }
        }
    }
 
开发者ID:jaeksoft,项目名称:jcifs-krb5,代码行数:11,代码来源:ListFilesAnon.java

示例11: traverse

import jcifs.smb.SmbFile; //导入方法依赖的package包/类
void traverse( SmbFile f, int depth ) throws MalformedURLException, IOException {

        if( depth == 0 ) {
            return;
        }

        SmbFile[] l = f.listFiles();

        for(int i = 0; l != null && i < l.length; i++ ) {
            try {
                int attrs = l[i].getAttributes();

                if(( attrs & 0x7FEE ) != 0) {
                    if(( attrs & 0x7FCE ) != 0) {
                        numMeta++;
                    }
                    numMetaWithArch++;
                }
                for (int b = 0; b < 16; b++) {
                    if(( attrs & (1 << b)) != 0 ) {
                        permissionCounts[b]++;
                    }
                }

                System.out.print( Hexdump.toHexString( l[i].getAttributes(), 4 ) + ": " );
                for( int j = maxDepth - depth; j > 0; j-- ) {
                    System.out.print( "    " );
                }
                System.out.println( l[i].getName()  );
                if( l[i].isDirectory() ) {
                    traverse( l[i], depth - 1 );
                }

                if(( attrs & SmbFile.ATTR_DIRECTORY ) != 0 ) {
                    numDirectories++;
                } else {
                    numFiles++;
                }
            } catch( IOException ioe ) {
                System.out.println( l[i] + ": " + ioe.getMessage() );
            }
        }
    }
 
开发者ID:codelibs,项目名称:jcifs,代码行数:44,代码来源:CountPerms.java


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