西安邮电大学《分布式计算原理及应用》实验报(9)

发布时间:2021-06-05

output.write(errorMessage.getBytes());

}

}

catch (Exception e) {

// thrown if cannot instantiate a File object

System.out.println(e.toString() );

}

finally {

if (fis!=null)

fis.close();

}

}

}

③发送请求的文件到web浏览器

package http;

import java.io.FileNotFoundException;

import java.io.FileOutputStream;

import java.io.PrintStream;

public class InputtoFilr {

public void saveinFile() {

try {

PrintStream ps = new PrintStream(new

FileOutputStream("D:\\test.txt"));

System.setOut(ps);

} catch (FileNotFoundException e) {

e.printStackTrace();

}

}

精彩图片

热门精选

大家正在看