Atitit.协议的转换smb2http 原理
2016-03-24 19:23
609 查看
Atitit.协议的转换smb2http 原理
作者:: ★(attilax)>>> 绰号:老哇的爪子 ( 全名::Attilax Akbar Al Rapanui 阿提拉克斯 阿克巴 阿尔 拉帕努伊 ) 汉字名:艾龙, EMAIL:1466519819@qq.com
转载请注明来源: http://www.cnblogs.com/attilax/
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
public class StreamUtil {
byte[] buffer = new byte[524288];
public void convertStream(InputStream in, OutputStream out) {
// InputStream in = new FileInputStream(srcFile);
// out = new FileOutputStream(destFile);
int byteread;
byteread = read(in);
while (byteread != -1) {
if (byteread != 0) {
try {
out.write(buffer, 0, byteread);
System.out.println("---out.write.."+byteread);
//out.flush();
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
byteread = read(in);
}
try {
in.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
out.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private int read(InputStream in ) {
int byteread;
try {
byteread = in.read(buffer,0,524288);
} catch (Exception e) {
e.printStackTrace();
byteread = 0;
}
return byteread;
}
}
1. 协议的转换原理 stream的转换..
2. 常用协议转换的情形
android通过SMB访问局域网共享文件作者:: ★(attilax)>>> 绰号:老哇的爪子 ( 全名::Attilax Akbar Al Rapanui 阿提拉克斯 阿克巴 阿尔 拉帕努伊 ) 汉字名:艾龙, EMAIL:1466519819@qq.com
转载请注明来源: http://www.cnblogs.com/attilax/
3. code
package com.attilax.util;import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
public class StreamUtil {
byte[] buffer = new byte[524288];
public void convertStream(InputStream in, OutputStream out) {
// InputStream in = new FileInputStream(srcFile);
// out = new FileOutputStream(destFile);
int byteread;
byteread = read(in);
while (byteread != -1) {
if (byteread != 0) {
try {
out.write(buffer, 0, byteread);
System.out.println("---out.write.."+byteread);
//out.flush();
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
byteread = read(in);
}
try {
in.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
out.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private int read(InputStream in ) {
int byteread;
try {
byteread = in.read(buffer,0,524288);
} catch (Exception e) {
e.printStackTrace();
byteread = 0;
}
return byteread;
}
}
相关文章推荐
- Atitit.android播放smb 网络邻居视频文件解决方案
- Atitit.android播放smb 网络邻居视频文件解决方案
- HTTP协议
- 戏说 TCP 三次握手 四次挥手
- okHttp使用介绍
- 网络流小结 - hdu 1532
- HTTP请求
- android https协议遇到的问题
- 对startssl的免费证书续期(续)
- okHttp使用及优缺点
- 【已解决】配置wget网络代理问题
- java TCP/IP Socket编程
- 用户IP地址的三个属性的区别(HTTP_X_FORWARDED_FOR,HTTP_VIA,REM_addr
- Atitit.android播放smb 网络邻居视频文件解决方案
- Atitit.android播放smb 网络邻居视频文件解决方案
- Atitit.android播放smb 网络邻居视频文件解决方案
- http与https的区别
- Android 通过httpclient请求web服务器,并解决用户登录session保持
- Opencv中ANN神经网络使用示例
- 针对Linux ASP.NET MVC网站中 httpHandlers配置无效的解决方案