JCIFSの例: String domain=null; String user="youraccountname"; String password="yourpassword"; NtlmPasswordAuthentication auth=NtlmPasswordAuthentication(domain, user, pass); SmbFile smb=new SmbFile("smb://yoursmbhost/yourshare/yourdirectory", auth); InputStream is=smg.getInputStream(); int rc=0; byte[] buff=new byte[1024]; while((rc=is.read(buff))>0) { your code } |
JCIFS-NGの例 String domain=null; String user="youraccountname"; String password="yourpassword"; Properties prop = new Properties(); prop.setProperty("jcifs.smb.client.minVersion", "SMB210"); prop.setProperty("jcifs.smb.client.maxVersion", "SMB300"); BaseContext bc = new BaseContext(new PropertyConfiguration(prop)); NtlmPasswordAuthentication creds = new NtlmPasswordAuthentication(bc, domain, user, pass); CIFSContext auth = bc.withCredentials(creds); SmbFile smb=new SmbFile("smb://yoursmbhost/yourshare/yourdirectory", auth); InputStream is=smg.getInputStream(); int rc=0; byte[] buff=new byte[1024]; while((rc=is.read(buff))>0) { your code } |