Java ByteBuffer Write writeFile(ByteBuffer data, File destination)

Here you can find the source of writeFile(ByteBuffer data, File destination)

Description

write File

License

Open Source License

Declaration

public static File writeFile(ByteBuffer data, File destination) throws IOException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.File;

import java.io.IOException;

import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;

import java.nio.file.StandardOpenOption;

public class Main {
    public static File writeFile(ByteBuffer data, File destination) throws IOException {
        try (FileChannel channel = FileChannel.open(destination.toPath(), StandardOpenOption.CREATE,
                StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.WRITE)) {
            channel.write(data);//w w  w.  j a  va  2s  . co  m
        }
        return destination;
    }
}

Related

  1. writeDouble(ByteBuffer buffer, double d)
  2. writeDouble(double v, ByteBuffer buffer)
  3. writeEmpty(final ByteBuffer buffer, final int type)
  4. writeFakeImageData(ByteBuffer out, int lzwMinCodeSize)
  5. writeFFloat(ByteBuffer buffer, float value)
  6. writeFile(File file, ByteBuffer bb)
  7. writeFile(File file, ByteBuffer buffer)
  8. writeFileFragment(FileChannel fc, long pos, ByteBuffer fragment)
  9. writeFloat(ByteBuffer buffer, float f)