本文整理汇总了Java中jcifs.smb.SmbFile.TYPE_PRINTER属性的典型用法代码示例。如果您正苦于以下问题:Java SmbFile.TYPE_PRINTER属性的具体用法?Java SmbFile.TYPE_PRINTER怎么用?Java SmbFile.TYPE_PRINTER使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类jcifs.smb.SmbFile
的用法示例。
在下文中一共展示了SmbFile.TYPE_PRINTER属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
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" );
}
示例2: main
public static void main( String[] argv ) throws Exception {
SmbFile file = new SmbFile( argv[0] );
int type;
switch( file.getType() ) {
case SmbFile.TYPE_FILESYSTEM:
type = 0;
break;
case SmbFile.TYPE_WORKGROUP:
type = 1;
break;
case SmbFile.TYPE_SERVER:
type = 2;
break;
case SmbFile.TYPE_SHARE:
type = 3;
break;
case SmbFile.TYPE_NAMED_PIPE:
type = 4;
break;
case SmbFile.TYPE_PRINTER:
type = 5;
break;
case SmbFile.TYPE_COMM:
type = 6;
break;
default:
throw new RuntimeException( "Unknown service type: " + file.getType() );
}
System.out.println( types[type] );
System.out.println();
long t1 = System.currentTimeMillis();
String[] files = file.list();
long t2 = System.currentTimeMillis() - t1;
for( int i = 0; i < files.length; i++ ) {
System.out.print( " " + files[i] );
}
System.out.println();
System.out.println( files.length + " files in " + t2 + "ms" );
}