现在的位置: 首页 > 综合 > 正文

java远程访问局域网内其他机器的共享文件

2014年02月04日 ⁄ 综合 ⁄ 共 595字 ⁄ 字号 评论关闭

代码基本不变,只是url有些变化。

 

public void getFile(String fileUrl){
       
        File file = new File(fileUrl);
        try {
            FileInputStream fis= new FileInputStream(file);
            BufferedReader br = new BufferedReader(new InputStreamReader(fis));
            System.out.println(br.readLine());
           
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
       
       
    }
   
   
   
    public static void main(String[] args) {
       
        String fileUrl = "////59.64.156.163//share//123.txt";
        new NormalRemoteAccess().getFile(fileUrl);
    }

}

 

这样基本能够正常的输出了。

抱歉!评论已关闭.