@ SuppressWarnings ( "resource" ) public static FileChannel openChannel ( File file , boolean mutable ) throws IOException { if ( mutable ) { return new RandomAccessFile ( file , "rw" ) . getChannel ( ) ; } return new FileInputStream ( file ) . getChannel ( ) ; }
open a readable or writeable FileChannel