Here you can find the source of dumpToFile(ByteBuffer buf, String fileName)
Parameter | Description |
---|---|
buf | The ByteBuffer to dump. |
fileName | The name of the file to dump to. |
public static void dumpToFile(ByteBuffer buf, String fileName)
//package com.java2s; //License from project: Open Source License import java.io.*; import java.nio.ByteBuffer; public class Main { /**//ww w . j a va2 s . co m * Dump the given {@link ByteBuffer}'s bytes to a file. * * @param buf The {@link ByteBuffer} to dump. * @param fileName The name of the file to dump to. */ public static void dumpToFile(ByteBuffer buf, String fileName) { try { final FileOutputStream fos = new FileOutputStream(fileName); fos.write(buf.array()); fos.close(); } catch (Exception e) { e.printStackTrace(); System.exit(-1); } } }