RandomAccessFile randomAccessFile = new RandomAccessFile(file,"rw");
FileChannel fileChannel = randomAccessFile.getChannel();
long size = fileChannel.size();
MappedByteBuffer mappedByteBuffer = fileChannel.map(FileChannel.MapMode.READ_WRITE,0,size);
for ( int i = 0 ; i < size; i++){
byte b = mappedByteBuffer.get(i);
mappedByteBuffer.put(i,b);
}
randomAccessFile.close();
fileChannel.close();
file = null;
fileChannel = null;
size = 0;
mappedByteBuffer = null;