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
Post a Comment