集册 Java实例教程 以16位无符号值形式写入数据长度,后跟实际数据。

以16位无符号值形式写入数据长度,后跟实际数据。

欢马劈雪     最近更新时间:2020-01-02 10:19:05

370
以16位无符号值形式写入数据长度,后跟实际数据。
/** 时 代 J     a    v  a - nowjava.com 提 供 **/


import java.io.IOException;

import java.io.InputStream;

import java.nio.ByteBuffer;

import java.util.Iterator;

import org.apache.log4j.Logger;


public class Main{

    /**

     * writes the length of data as an 16 bit unsigned value, followed by the

     * actual data. does not check that the length of the data-array actually

     * fits in the lengths field.

     * 

     * @param buf

     * @param data

     */

    final static public void writeArray16(
展开阅读全文