我想使用MultipartEntity和HttpPost将hdfs文件发布到url,如何在下面的代码中指定文件/ contentbody
HttpPost httppost = new HttpPost("someurl");
MultipartEntity entity=new MultipartEntity();
entity.addPart("data",new FileBody(file)); // Here i need to specify file or inputstream
httppost.setEntity(entity);
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpResponse response = httpclient.execute(httppost);
我正在使用FileSystem calss
来引用文件Path filepath=new Path(args[0]);
FileSystem fs=FileSystem.get(new Configuration());
fs.open(filepath) // returns FSDataInputStream