Atitit.協定的轉換smb2http 原理
1. 協定的轉換原理 stream的轉換..
2. 常用協定轉換的情形
android通過SMB通路區域網路共享檔案
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);
}
in.close();
} catch (IOException e) {
// TODO Auto-generated catch block
out.close();
private int read(InputStream in ) {
byteread = in.read(buffer,0,524288);
byteread = 0;
return byteread;