java 写内容到远程文件

FileInputStream in = new FileInputStream(new File("D:/xx/a.txt"));            
URL url = new URL("http://ebook.ruanko.com/xxx/a.txt");
URLConnection connection =  url.openConnection();
connection.setDoOutput(true);
DataOutputStream ou = new DataOutputStream(connection.getOutputStream());
                byte[] buffer = new byte[4096];
                int count = 0;
                while ((count = in.read(buffer)) > 0) {
                    ou.write(buffer, 0, count);
                }
                ou.flush(); 
                ou.close();
                in.close();

 需求就是将本地磁盘d://xx/a.txt文件的内容写到远程WEB地址中的http://aaa.bbb.com WEB项目下的a.txt文件中,程序可以正常运行,带式就是内容没有写进去,不知道为什么?有遇到过类似问题的吗?

远程的机器你是写不进去的。

你可以使用java的ftp相关api写入

如果能写进去岂不是就可以修改http://www.baidu.com/index.php这个文件了