从文件中删除元数据 [英] Removing meta data from the file

查看:208
本文介绍了从文件中删除元数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我的方法签名.

    @POST
    @Path("/upload/{user_id}/{user_type}")
    @Produces("application/json")
    public Response fileUploader(InputStream a_fileInputStream,
                                      @PathParam("user_id") String user_id,
                                      @PathParam("user_type") String logType,
                                      @Context ContainerRequestContext crc)  {

//WRITE INPUTSTREAM TO FILE


}

我能够成功地将内容写入我的文件,但是有一些元数据写入了我的文件 在文件开始时,将写入以下元数据:

I am able to write content to my file successfully, but there is some meta data which is written to my file at start of my file the following meta data is written:

------WebKitFormBoundaryvsdfdsffsdrsr
Content-Disposition: form-data; name="fileUpload"; filename="2mb.txt"
Content-Type: text/plain

文件结尾

------WebKitFormBoundaryvsdfdsffsdrsr

我不希望这些元数据出现在我的文件中.

I dont want these meta data to be present in my file.

我正在使用Advance REST Client chrome插件并使用以下参数:

I am using Advance REST Client chrome plugin and using the following parameters:

METHOD : POST
url : http://localhost:8080/api/upload/1/normal
Content-Type: application/octet-stream
added one file to it : 2mb.txt

我想将这个api与curl一起使用,因此以下是我的curl命令:

I want to use this api with curl so the following is my curl command:

curl -XPOST http://localhost:8080/api/upload/1/normal --data-binary @2mb.txt

我只想从正在创建的文件中删除这些行.

I just want to remove those lines from my file which I am creating.

谢谢.

推荐答案

@FormDataParam("fileUpload")批注放置在InputStream参数的前面.

Place the @FormDataParam("fileUpload") annotation in front of the InputStream parameter.

这篇关于从文件中删除元数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆