Tag: jcifs

使用jcifs读取文件的最简单方法

我正在尝试使用外部jcifs库从网络共享中读取文件。 我可以找到的大多数用于读取文件的示例代码非常复杂,可能不必要。 我找到了一种写入文件的简单方法,如下所示。 有没有办法使用类似的语法读取文件? SmbFile file= null; try { String url = “smb://”+serverAddress+”/”+sharename+”/TEST.txt”; NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(null, username, password); file = new SmbFile(url, auth); SmbFileOutputStream out= new SmbFileOutputStream(file); out.write(“test string”.getBytes()); out.flush(); out.close(); } catch(Exception e) { JOptionPane.showMessageDialog(null, “ERROR: “+e); }

JCIFS中存在某些非ascii字符的问题

我正在使用JCIFS来访问一个包含很多日文名称的文件共享,当我在其中的字符时遇到问题 例如: 路径人事部/要员·コスト管理课程/ 第一部分没问题,但第二部分引起了问题。 这可能与“·”可以使用斜线输入的事实有关,但我不确定。 我试过逃避角色,但似乎没有解决问题。 你有什么可能导致它的线索吗?

JCIFS NTLM库的替代品

有没有JCIFS NTLM库的替代品?

Android SDK:Samba服务器使用VideoView将video流式传输到Android?

我需要播放从samba到android设备流的video。 我一直在寻找这个问题 ,有人说: 使用JCIFS扫描并“查看”共享: http ://jcifs.samba.org/ 实现一个简单的HTTP服务器(NanoHttpd)通过http: https : //github.com/NanoHttpd/nanohttpd流式传输内容 将http://localhost/myvideo链接传递给VideoView 我已经使用JCIFS在我的项目中获取SmbFile,我也得到了inputstream(smbfile.getInputStream())。 现在我导入NanoHttpd并创建一个简单的HTTP服务器,其http地址为http://localhost:8080 private class MyHTTPD extends NanoHTTPD { public MyHTTPD() throws IOException { super(8080); } @Override public Response serve(String uri, String method, Properties header, Properties parms, Properties files) { InputStream is = new SmbFile(filePath,auth).getInputStream(); //return index as response return new NanoHTTPD.Response(HTTP_OK, “video/mp4”, is); } […]

JCIFS:文件检索太慢而无法使用

我只是测试JCIFS来访问Windows共享。 完全无法使用它是非常缓慢的。 import jcifs.smb.*; class First { public static void main(String[] args) throws Exception { try { //jcifs.Config.setProperty( “jcifs.netbios.wins”, “192.168.1.220” ); NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(“domain.com”, “Administrator”, “password”); SmbFile f = new SmbFile(“smb://10.17.15.12/Share/xml/file.xml”, auth); SmbFileInputStream in = new SmbFileInputStream(f); byte[] b = new byte[8192]; int n; while(( n = in.read( b )) > 0 ) […]

如何使用Java中的jcifs将文件从smb共享复制到本地驱动器?

有人可以帮我将文件从共享文件夹复制到本地驱动器吗? 我的代码是: import jcifs.smb.NtlmPasswordAuthentication; import jcifs.smb.SmbFile; import jcifs.smb.SmbFileInputStream; import jcifs.smb.SmbFileOutputStream;; public class smb { /** * @param args * @throws IOException */ public static void main(String[] args) throws IOException { // TODO Auto-generated method stub String urlToBackUpFile = “smb://ip/backup$/test.txt”; System.out.println(“smb folder of source file” + urlToBackUpFile); NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(null, “login”, “pass”); SmbFile dir […]

使用Java和Samba JCIFS访问文件

我有一个关于使用Samba JCIFS访问文件的问题。 所以有一个我想访问的服务器,我们称之为server.unv.edu,工作组是WKGRP。 此服务器中有一个共享:\\ server.unv.edu \ pcb $ 我试图访问服务器的方式是: public class SMBAuthenticator extends NtlmAuthenticator{ private String username = “username”; private String password = “password”; private String domain = “smb://server.unv.edu/WKGRP/”; public SMBAuthenticator(){ NtlmAuthenticator.setDefault(this); } 和 public class SMBConnection{ public String urlString = “smb://server.unv.edu/pcb$/path/file.txt”; NtlmPasswordAuthentication auth; SmbFile smbFile; public SMBConnection() throws MalformedURLException{; //url = new URL(urlString); SMBAuthenticator […]

使用java连接到Windows中的共享文件夹

我需要通过java连接到远程Windows机器上的共享文件夹,在那里我将我的域身份validation(用户名和密码)放在代码中,这是我的代码 File file = new File(“\\\\theRemoteIP\\webapps”); File[] files = file.listFiles(); System.out.println(“acssed done”); for (int i = 0; i < files.length; i++) { String name = files[i].getName(); System.out.println(name); } 谢谢