OutputStream (final Object requestor, final long newModificationStamp, long newTimeStamp) { final VirtualFile self = this; return new ByteArrayOutputStream() { @Override public void close() throws IOException { super.close(); long oldStamp = getModificationStamp(); setModificationStamp(newModificationStamp); setText(toString()); myDocumentManager.contentsChanged(new VFileContentChangeEvent(null, self, oldStamp, getModificationStamp())); } }; }