/usr/share/doc/libjcifs-java/examples/FileInfo.java is in libjcifs-java-doc 1.3.19-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | import java.util.*;
import java.text.*;
import java.net.*;
import jcifs.smb.*;
public class FileInfo {
static final String TYPES[] = {
"TYPE_COMM",
"TYPE_FILESYSTEM",
"TYPE_NAMED_PIPE",
"TYPE_PRINTER",
"TYPE_SERVER",
"TYPE_SHARE",
"TYPE_WORKGROUP"
};
public static void main( String argv[] ) throws Exception {
int i, start, end;;
SimpleDateFormat sdf = new SimpleDateFormat( "MM/dd/yy hh:mm:ss a" );
GregorianCalendar cal = new GregorianCalendar();
SmbFile f;
if( argv.length < 2 ) {
throw new IllegalArgumentException( "usage: FileInfo <url> <opindex>" );
}
if( argv.length == 3 ) {
SmbFile tmp = new SmbFile( argv[0] );
f = new SmbFile( tmp.toString(), argv[1] );
start = Integer.parseInt( argv[2] );
} else {
f = new SmbFile( argv[0] );
start = Integer.parseInt( argv[1] );
}
sdf.setCalendar( cal );
i = end = start;
do {
switch( i ) {
case 0:
System.out.println( " toString: " + f.toString() );
break;
case 1:
System.out.println( " toURL: " + f.toURL() );
break;
case 2:
System.out.println( " getName: " + f.getName() );
break;
case 3:
System.out.println( " length: " + f.length() );
break;
case 4:
System.out.println( " getLastModified: " + sdf.format( new Date( f.getLastModified() )));
break;
case 5:
System.out.println( " isHidden: " + f.isHidden() );
break;
case 6:
System.out.println( " isFile: " + f.isFile() );
break;
case 7:
System.out.println( " isDirectory: " + f.isDirectory() );
break;
case 8:
System.out.println( " hashCode: " + f.hashCode() );
break;
case 9:
System.out.println( " getUncPath: " + f.getUncPath() );
break;
case 10:
System.out.println( " getType: " + TYPES[f.getType()] );
break;
case 11:
System.out.println( " getShare: " + f.getShare() );
break;
case 12:
System.out.println( " getServer: " + f.getServer() );
break;
case 13:
System.out.println( " getPath: " + f.getPath() );
break;
case 14:
System.out.println( " getParent: " + f.getParent() );
break;
case 15:
System.out.println( " lastModified: " + sdf.format( new Date( f.lastModified() )));
break;
case 16:
System.out.println( "getDiskFreeSpace: " + f.getDiskFreeSpace() );
break;
case 17:
System.out.println( " getDate: " + sdf.format( new Date( f.getDate() )));
break;
case 18:
System.out.println( "getContentLength: " + f.getContentLength() );
break;
case 19:
System.out.println( "getCanonicalPath: " + f.getCanonicalPath() );
break;
case 20:
System.out.println( " exists: " + f.exists() );
break;
case 21:
System.out.println( " canRead: " + f.canRead() );
break;
case 22:
System.out.println( " canWrite: " + f.canWrite() );
break;
case 23:
ACE[] security = f.getSecurity(true);
System.out.println( " Security:" );
for (int ai = 0; ai < security.length; ai++) {
System.out.println(security[ai].toString());
}
System.out.println(" Share Perm:");
security = f.getShareSecurity(true);
for (int ai = 0; ai < security.length; ai++) {
System.out.println(security[ai].toString());
}
break;
case 24:
System.out.println( " getDfsPath: " + f.getDfsPath() );
break;
}
i++;
if( i == 25 ) {
i = 0;
}
} while( i != end );
}
}
|