- 浏览: 96593 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (61)
- Hibernate (5)
- WebService (6)
- Python (13)
- ExtJs (0)
- Java (20)
- SMB (1)
- Game (1)
- Java Advanced Image (1)
- CMD (4)
- Oracle (2)
- Windows (2)
- Linux (1)
- Forums (1)
- Struts (2)
- Internationalization (1)
- NTLM (1)
- HttpClient (1)
- Http (1)
- Form (1)
- Tomcat (2)
- Log4j (1)
- Eclipse (1)
- ant (1)
- soap (0)
- SSL (2)
- security (2)
- permission (1)
- 面试 (0)
- authentication (1)
- Spring (0)
- ioc (0)
- javascript (1)
- license (0)
- web (0)
- Maven (0)
- website (0)
- tool (0)
- git (1)
- Thread (2)
- 软件工程 (0)
- mongodb (1)
最新评论
-
howgoo:
OpenSystemArchitect 中文乱码。
免费的数据库建模工具 -
tojaoomy:
如果需要输出时不换行,在最后加上逗号即可。比如print 'H ...
Python静态属性,静态方法 -
tojaoomy:
http://www.oracle.com/technetwo ...
丢失更新 -
tojaoomy:
teasp 写道tojaoomy 写道teasp 写道toja ...
synchronized (this) 柳暗花明又一村 -
teasp:
tojaoomy 写道teasp 写道tojaoomy 写道t ...
synchronized (this) 柳暗花明又一村
import java.io.IOException; import java.net.MalformedURLException; import java.net.UnknownHostException; import jcifs.smb.SmbException; import jcifs.smb.SmbFile; import jcifs.smb.SmbFileInputStream; public class SMBTest { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub try { SmbFile file = new SmbFile( "smb://administrator:password@ip/hejian/hello.txt"); SmbFileInputStream sfis = new SmbFileInputStream(file); byte b[] = new byte[2]; while (-1 != sfis.read(b)) { System.out.print(new String(b)); } sfis.close(); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SmbException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { } } }
假如公司有域认证的话,上面的方法就行不通了,不过还有另外一方法:
package com.rits.samplescan.smb; import java.io.IOException; import java.net.MalformedURLException; import java.net.UnknownHostException; import jcifs.smb.NtlmPasswordAuthentication; import jcifs.smb.SmbException; import jcifs.smb.SmbFile; import jcifs.smb.SmbFileInputStream; public class SMBTest { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub String domain = "domain"; String username = "username"; String password = "password"; NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(domain,username,password); try { SmbFile file = new SmbFile( "smb://10.10.10.18/share/hello.txt" ,auth); SmbFileInputStream sfis = new SmbFileInputStream(file); byte b[] = new byte[2]; while (-1 != sfis.read(b)) { System.out.print(new String(b)); } sfis.close(); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SmbException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { } } }
- jcifs-1.3.17.jar (386.9 KB)
- 下载次数: 1
发表评论
-
Filter,Servlet,Conponent如何获取ApplicationContext
2014-08-04 18:35 1247Filter 获取Context 在init()方法获取S ... -
synchronized (this) 柳暗花明又一村
2013-05-17 16:23 1548今天写一个测试类,主要是测试wait(long timeo ... -
同一个线程synchronized方法调用synchronized方法
2013-02-21 16:28 975一个线程里面有两个synchronized方法a(),b( ... -
Java开源工具:网站开发工具清单
2012-07-23 14:07 0【IT168 技术】美国程序员Jon Sco ... -
Maven construct Maven Project
2012-07-17 17:36 0<project xmlns="http ... -
开源中最好的Web开发的资源
2012-06-20 09:52 0文章来源:Best “must know” open sour ... -
SimulateSpringIOC
2012-05-20 15:05 0Code View: package jp.co.ri ... -
User Authentication
2012-05-18 14:35 1782The Java Authentication and Aut ... -
Java SSL
2012-05-14 16:40 1126一直调查SSL的问题,毫无进展,头疼,先把手头搞定的资料整理 ... -
Security Managers and Permissions
2012-05-11 17:44 997Once a class has been loaded in ... -
[转]Web Services Over SSL - HOW TO
2012-05-07 15:31 928一篇好文章,原文地址:http://www.pankaj- ... -
Java Use the keyword goto
2012-05-07 14:53 0Today,I am unconsciously found ... -
HttpClient Access to HTML Form
2012-03-19 17:27 978Sample Html Form Code: <s:f ... -
Top 10 Java Developer Forums
2012-03-08 15:46 1127Developers get into tricky situ ... -
发几个收藏的Java游戏
2012-02-29 13:47 645JavaMine.jar 扫雷 jdiamonds. ... -
Axis2 integrate with tomcat occur "unsupport" error
2012-02-27 14:42 1872Creating a Dynamic web project ... -
PD(PowerDesigner) 导出的sql中去掉双引号
2012-02-20 23:21 0http://user.qzone.qq.com/714719 ... -
JAEE5.0工程JSTL不能正常使用解决办法
2012-02-21 18:21 932在Tomcat的安装路径下:apache-tomcat-7.0 ... -
通过六个题目彻底掌握String笔试面试题
2012-02-21 18:22 7391 public static void main( ... -
PowerDesigner(15.1.0.2805)反向工程错误解决汇总
2012-02-20 23:14 1325错误一:Non SQL Error : Could not ...
相关推荐
"Move to Applications folder" 是一个针对Mac应用的实用工具,其主要目的是帮助用户方便地将应用程序移动到Mac的"应用程序"文件夹中。在Mac OS操作系统中,将应用程序放置在"应用程序"文件夹是标准的做法,因为这...
As we all know, We often need to share some files including such as documents, video,... All visits are under your surveillance, you can quickly stop any shared folder to prevent the unauthorized access.
软件名:KaKaSoft Folder Protector V5.39(附破解补丁) 简介:轻松对电脑、U盘、数码相机、移动硬盘等中的文件夹进行加密 使用方法: 1. 双击“Folder Protector V5.39 破解补丁.exe”破解软件 2. 软件...
fail_to_use_service_name_to_access_share_folder_in_Win2008_cluster
Folder conversion: Entire folders of C# code files are converted to Java code files.(文件夹转换) 2. Code snippet and file conversion: Our snippet conversion accuracy is outstanding and does not ...
这个问题主要体现在"Add Files to Folder"功能失效,即用户无法通过VC6.0向工程中添加新的文件或文件夹。 "Add Files to Folder"是VC6.0中的一个重要功能,它允许开发者将源代码、头文件或其他资源文件添加到项目中...
### 安装提示“folder depth is too large to run the setup”的解决方案 在进行软件或应用程序安装过程中,有时会遇到一个令人头疼的问题:“folder depth is too large to run the setup”。这个问题通常发生在...
Instructions on how to download and install the JavaMail API are contained in the course. In addition, you will need a development environment such as the JDK 1.1.6+ or the Java 2 Platform, Standard...
win7 office2007 删除Groove Folder Synchronization菜单项 http://hi.baidu.com/fei126222/blog/item/dde559dc439ae2adcc11661b.html
【标题】"java_folder:核心java编程"是一个与Java编程相关的资源包,它可能包含了学习和深入理解Java语言核心概念的教程、代码示例或项目。这个资源可能适合初学者和有一定经验的开发者,帮助他们巩固基础知识,...
External Access Folder - Honeywell Confidential.docx
java PDFToImageConverter path_to_pdf_file.pdf path_to_output_folder 请将path_to_pdf_file.pdf替换为您要转换的PDF文件的路径,将path_to_output_folder替换为输出图像的文件夹路径。 脚本将使用Apache PDFBox库...
Unknown error: Unable to build: the file dx.jar was not loaded from the SDK folder! 问题的缺失文件 eclipse.buildId=M20100211-1343 java.version=1.6.0_10-rc2 java.vendor=Sun Microsystems Inc. ...
"kill_folder 专杀"工具是一款专门针对名为"kill_folder"的文件病毒设计的安全软件。在深入了解这个工具之前,我们首先要理解什么是文件病毒以及它如何影响计算机系统。 文件病毒是一种恶意软件,它会附着在可执行...
在IT领域,特别是软件开发中,"VC folder tree access" 指的是使用Visual C++(简称VC)来实现对文件系统的目录结构进行树形展示和访问的功能。这个功能常见于许多应用程序,如资源管理器或者自定义的文件操作界面,...
windows-folder-remark-master.zip windows-folder-remark-master.zip windows-folder-remark-master.zip windows-folder-remark-master.zip windows-folder-remark-master.zip windows-folder-remark-master.zip ...
This sample shows how to create, read, write, copy and delete a file, how to retrieve file properties, and how to track a file or folder so that your app can access it again. This sample uses Windows....
《文件管理 ToFolder v1.0:提升Windows文件操作效率》 在计算机使用过程中,文件管理是一项基础且频繁的任务。Windows操作系统内置的“资源管理器”以其直观的图形用户界面(GUI)为用户提供了丰富的文件操作功能...
一键去除视频和图片水印
本项目名为"java-folder",可能是一个Java学习资源或项目的代码库。 1. **Java基础知识** - 类与对象:Java是一种面向对象的语言,一切皆为对象。类是创建对象的蓝图,包含数据(属性)和行为(方法)。 - 封装、...