public static com.vlc.edge.FileChannel createChannel(final File file) { final FileChannel channel = null; try { channel = new FileInputStream(file).getChannel(); channel.position(0); FileChannel res = new FileChannelImpl(channel); channel = null; return res; } catch (FileNotFoundException e) { throw new VlcRuntimeException("Failed to open file: " + file, e); } catch (IOException e) { throw new VlcRuntimeException(e); } finally { if (channel != null) { try { channel.close(); } catch (...) { ... } } } }
FileChannel readChannel = new FileChannel.open(inPath, READ); FileChannel writeChannel = new FileChannel.open(outPath, WRITE, TRUNCATE_EXISTING) ) { long readFileSize = readChannel.size();