Here you can find the source of outputBuffer(ByteBuffer buffer)
public static void outputBuffer(ByteBuffer buffer)
//package com.java2s; //License from project: Open Source License import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.OutputStream; import java.nio.ByteBuffer; public class Main { private static int frame = 0; public static void outputBuffer(ByteBuffer buffer) { try {/*from w ww. j a va2s . c o m*/ byte[] rawBytes = new byte[buffer.capacity()]; buffer.get(rawBytes); File outputFile = new File(String.format("owf_%04d.bin", frame)); OutputStream streamOut = new BufferedOutputStream(new FileOutputStream(outputFile)); streamOut.write(rawBytes); streamOut.close(); } catch (Throwable th) { th.printStackTrace(); } } }