该篇主要完成数据传输过程,无论字节信息接收还是发送,如果信息量过大,无法一次性传输,需要分批传输/接收。
一、数据发送
public void send(OutputStream dos, byte[] buffer) throws IOException {
dos.write(buffer);
}
虽然write是传入整个字节数据。底层存在分批发送。
二、数据接收
public byte[] receive(InputStream dis, int totalLen) throws Exception {
byte[] buffer = new byte[totalLen]