@Override
    public void write(int b) throws IOException {
        if (migrated || handler == null) {
            handler = new RandomAccessFile(targetFile, "rw");
            handler.seek(offset);
            migrated = false;
        }
        handler.write(b);
        offset++;
    }