转换从Android中的HTTP PUT接收的原始JPEG字节

时间:2014-02-21 19:04:29

标签: android http http-headers streaming airplay

我收到了这种格式的HTTP PUT -

PUT /photo HTTP/1.1
X-Apple-AssetKey: F92F9B91-954E-4D63-BB9A-EEC771ADE6E8
X-Apple-Transition: Dissolve
Content-Length: 456850
User-Agent: MediaControl/1.0
X-Apple-Session-ID: 1bd6ceeb-fffd-456c-a09c-996053a7a08c

<HERE COMES THE JPEG DATA>

喜欢 -

 [ PUT /photo HTTP/1.1 ]
 [ X-Apple-AssetAction: cacheOnly ]
 [ X-Apple-AssetKey: 00000000-0000-0000-0000-000000000068]
 [ Content-Length: 462848 ]
 [ User-Agent: MediaControl/1.0]
 [ X-Apple-Session-ID: 16d9a403-82ac-48ee-8402-5315fc018f9d ]
 [ ????????? ]  
 [  ] 
 [  ]
 [ ]
 [???? ? ? "?? ?? ????? ????????????????  ]
 [ ?? ???? } ?? !1A Qa "q 2??? #B?? R??$3br? ]
 [ %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz????????????????????????????????????????????????????????????????????????? ?? ????????????   

等......

我有相同的情景 - Http PUT Request to jpeg。我在这里将数据包装在“[]”括号之间。

如何将此JPEG数据写入JPEG图像?

1 个答案:

答案 0 :(得分:0)

从您引用的回复中,找到标题的结尾后:

  1. 打开输出流到文件。
  2. 继续迭代输入流
  3. 将您读取的每个块写入输出流。
  4. 你需要伪代码吗?