public static void writeFully ( FileChannel fc , ByteBuffer buf , long offset ) throws IOException { do { offset += fc . write ( buf , offset ) ; } while ( buf . remaining ( ) > 0 ) ; }
Write a ByteBuffer to a FileChannel at a given offset handling short writes .