Deleting fixed number of data from file in java or android -


my question clear. per current api can delete whole file or delete whole content of file. need deleting fixed number of bytes ( data ) file. if have file of size 30mb. wanna delete 2mb of data (from starting position not ending position). file reduce 28mb. in advance

use filechannel.truncate(n) trim file specified size n.

         long n = 4096;           file file =  new file("file_path");          randomaccessfile raf = new randomaccessfile(file, "rw");          filechannel fc = raf.getchannel();           fc.truncate(n);             fc.size()  

Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -