Example usage for java.nio.file Files newByteChannel

List of usage examples for java.nio.file Files newByteChannel

Introduction

In this page you can find the example usage for java.nio.file Files newByteChannel.

Prototype

public static SeekableByteChannel newByteChannel(Path path, OpenOption... options) throws IOException 

Source Link

Document

Opens or creates a file, returning a seekable byte channel to access the file.

Usage

From source file:srebrinb.compress.sevenzip.SevenZOutputFile.java

/**
 * Opens file to write a 7z archive to./*w w w  .  j av a2  s .  c  om*/
 *
 * @param filename the file to write to
 * @throws IOException if opening the file fails
 */
public SevenZOutputFile(final File filename) throws IOException {
    this(Files.newByteChannel(filename.toPath(), EnumSet.of(StandardOpenOption.CREATE, StandardOpenOption.WRITE,
            StandardOpenOption.TRUNCATE_EXISTING)));
}