Here you can find the source of writeByteArray(byte[] data, ByteBuffer buffer)
public static void writeByteArray(byte[] data, ByteBuffer buffer) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.nio.ByteBuffer; public class Main { public static void writeByteArray(byte[] data, ByteBuffer buffer) throws IOException { buffer.put(data);/* w w w . ja va2 s. c om*/ } public static void writeByteArray(byte[] data, int offset, int length, ByteBuffer buffer) throws IOException { buffer.put(data, offset, length); } }