This should only be called when either the file's contents change externally,
or when the file saves to disk.
964094
public void refresh( Path file )
  {
    EditorHost editor = findTab( file );
    if( editor != null )
    {
      // The file is open in an editor, refresh it with the contents of the file

      try( Reader reader = PathUtil.createReader( file ) )
      {
        editor.refresh( StreamUtil.getContent( reader ) );
        setDirty( editor, false );
      }
      catch( IOException e )
      {
        throw new RuntimeException( e );
      }
    }

    FileTree root = FileTreeUtil.getRoot();
    FileTree node = root.find( file );

    if( node != null )
    {
      // Refresh the type system to include the changes
      IType type = node.getType();
      if( type != null )
      {
        reload( type );
      }
    }
  }
864315
def on_moved(self, event):
        
        logger.debug("file moved: %s -> %s", event.src_path, event.dest_path)
        if not event.is_directory:
            self.update_file(event.dest_path)
89159
function __save(filename, content, json){
  json = json === true

  if (json) {
    fs.writeFileSync(filename, JSON.stringify(content))
  } else {
    fs.writeFileSync(filename, content)
  }
}
477787
@Override
    public void readExternal(ObjectInput s) throws IOException, ClassNotFoundException {
        // writeExternal has already mapped filechannel content into a real buffer
        // so on reading it back, we just set up as though convert() was already
        // called
        this.status = WsByteBuffer.STATUS_BUFFER;
        super.readExternal(s);
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "readExternal(ObjectInput)");
        }
    }
700157
def on_any_event(self, event):
        """"""
        if os.path.isfile(event.src_path):
            self.callback(event.src_path, **self.kwargs)
549424
function(self, options, callback) {
  if (typeof options === 'function') {
    callback = options;
    options = {};
  }

  options = options || self.writeConcern;

  if (self.fileId != null) {
    self.chunkCollection().remove({ files_id: self.fileId }, options, function(err) {
      if (err) return callback(err, false);
      callback(null, true);
    });
  } else {
    callback(null, true);
  }
}
761650
function(changed) {
			$.each(changed, function(i, file) {
				var hash = file.hash;
				if (files[hash]) {
					$.each(Object.keys(files[hash]), function(i, v){
						if (typeof file[v] === 'undefined') {
							delete files[hash][v];
						}
					});
				}
				files[hash] = files[hash] ? Object.assign(files[hash], file) : file;
			});
		}
368346
void writeExternal(DataOutput out) throws IOException {
        Ser.writeEpochSec(toEpochSecond(), out);
        Ser.writeOffset(offsetBefore, out);
        Ser.writeOffset(offsetAfter, out);
    }
361155
function handleCurrentFileChange() {
        var newFile = MainViewManager.getCurrentlyViewedFile(MainViewManager.ACTIVE_PANE);

        if (newFile) {
            var newDocument = DocumentManager.getOpenDocumentForPath(newFile.fullPath);

            if (newDocument) {
                _currentTitlePath = _shortTitleForDocument(newDocument);
            } else {
                _currentTitlePath = ProjectManager.makeProjectRelativeIfPossible(newFile.fullPath);
            }
        } else {
            _currentTitlePath = null;
        }

        // Update title text & "dirty dot" display
        _updateTitle();
    }
1089594
private boolean isExternal(String filename) {

        boolean external = false;
        if (filename.indexOf("://") > 0) {
            external = true;
        }
        return external;
    }
48594
function onInit(unused, callback) {
    var filePath = path.resolve(options.file);

    stats.deserialise.fs.start = Date.now();
    if (fs.existsSync(filePath)) {
      fs.readFile(filePath, complete);
    } else {
      complete(true);
    }

    function complete(error, contents) {
      stats.deserialise.fs.stop = Date.now();

      stats.deserialise.decode.start = Date.now();
      pending = !error && contents && cycle.retrocycle(decode(JSON.parse(contents)));
      stats.deserialise.decode.stop = Date.now();

      stats.deserialise.success = !error;
      callback();
    }
  }
9118
def save(self, outfile):
        """"""
        if isinstance(outfile, compat.string_type):
            outfile = open(outfile, 'wb')
        assert hasattr(outfile, 'write') and callable(outfile.write), \
            "Expect a file or file-like object with a .write() method"
        outfile.write(self.data)
1330178
def if_file_changed(file, &block)
      if_string_changed(file, Digest::SHA256.file(file).hexdigest.to_s, &block)
    end
1132747
private void checkFileReopening(FileObject fileObject, boolean addToHistory) throws FilerException {
        for(FileObject veteran : fileObjectHistory) {
            if (fileManager.isSameFile(veteran, fileObject)) {
                if (lint)
                    log.warning("proc.file.reopening", fileObject.getName());
                throw new FilerException("Attempt to reopen a file for path " + fileObject.getName());
            }
        }
        if (addToHistory)
            fileObjectHistory.add(fileObject);
    }
362827
function(info, file, opts) {
  if (typeof opts == 'boolean') { // old arugment backup
    opts = {backup: opts};
  }
  opts = opts || {};
  var err = null;
  try {
    ensureDirectoryExists(path.dirname(file));
    if (opts.backup && fileExists(file)) {
      fs.renameSync(file, file + '.bak');
    }
    jsonfile.writeFileSync(file, info, { spaces: 2 });
  } catch (e) {
    err = e;
  }
  return err;
}
267239
public function markChanged(): void
    {
        $this->changed = true;
        $this->xliff->setDate(new \DateTime());
        if (!$this->buffering) {
            $this->xliff->save($this->filename);
        }
    }
1340854
function (storeOrEditor, logFn) {
    debug('Dumping contents of in-memory store.');
    var logFunc = logFn || console.log;
    this.processInMemoryStore(storeOrEditor, file => {
      logFunc.call(this, file.path + ' [STATE:' + file.state + ']');
      /*
       logFunc.call(this, JSON.stringify(file, function (k, v) {
       if (k === '_contents') {
       if (undefined !== v) {
       return 'data';
       }
       }
       return v;
       }));
       */
    });
  }