我正在与HttpUrlConnection
班级一起上传文件。
conn.setRequestMethod("PUT");
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setRequestProperty("Trailer", "Content-Integrity");
conn.setFixedLengthStreamingMode((int) (getSourceSize()-pos));
while ((bytes = in.read(block, 0, DEFAULT_BLOCK_SIZE)) > 0) {
out.write(block, 0, bytes);
}
之后我需要发送 Content-Integrity 标头,例如: Content-Integrity: sha-256:bdcf7f645fd53dd3b3763f59376134ff58cc337247c978bdd178b6ccdfbff19f
我怎样才能做到这一点?