/// <exception cref="System.IO.IOException"/> internal static ByteBuffer ReadFileToByteBuffer(FileInfo file) { FileStream randomAccessFile = null; try { randomAccessFile = PortUtil.GetReadOnlyRandomAccesFile(file); byte[] bytes = new byte[(int)randomAccessFile.Length]; randomAccessFile.ReadFully(bytes); return(ByteBuffer.Wrap(bytes)); } finally { if (randomAccessFile != null) { randomAccessFile.Dispose(); } } }