13,100
社区成员
发帖
与我相关
我的任务
分享
/** Send image data. */
private void sendImageData(byte[] imgData, StreamConnection conn) {
if (imgData == null) {
return;
}
OutputStream out = null;
try {
out = conn.openOutputStream();
out.write(imgData.length >> 8); ---------------->这一行中write()的参数做什么用的,为什么要>>8
out.write(imgData.length & 0xff);
out.write(imgData);
out.flush();
} catch (IOException e) {
System.err.println("Can't send image data: " + e);
}
// close output stream anyway
if (out != null) {
try {
out.close();
} catch (IOException e) {
} // ignore
}
}