import java.io.File;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import static java.nio.file.StandardOpenOption.*;

public class MappedFileBug {
    public static void main(String[] args) throws Exception {
        var file = File.createTempFile("test", null);
        var channel = FileChannel.open(file.toPath(), READ, WRITE);
        MappedByteBuffer buffer = channel.map(FileChannel.MapMode.READ_WRITE, 0, 1000);
        buffer.putInt(1234);
        buffer.limit(4);
        buffer.force();
    }
} 