问题
I am receiving an HTTP PUT in this format -
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>
like -
[ 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????????????????????????????????????????????????????????????????????????? ?? ????????????
so on....
I have the same scenario - Http PUT Request to jpeg. I have wrapped data in between " [ ] " brackets here.
How can I write this JPEG Data to JPEG Image?
回答1:
From the response you reference, after finding the end of the headers:
- Open an output stream to a file.
- Continue iterating over the input stream
- Write every block you read into the output stream.
Do you need pseudo-code?
来源:https://stackoverflow.com/questions/21943066/conversion-of-raw-jpeg-bytes-received-from-http-put-in-android