BlockId append ( String fileName , IoBuffer buffer ) { try { IoChannel fileChannel = getFileChannel ( fileName ) ; // Rewind the buffer for writing buffer . rewind ( ) ; // Append the block to the file long newSize = fileChannel . append ( buffer ) ; // Return the new block id return new BlockId ( fileName , newSize / BLOCK_SIZE - 1 ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; return null ; } }
Appends the contents of a byte buffer to the end of the specified file .