@Override @NotNull public OutputStream getOutputStream(@NotNull VirtualFile file, Object requestor, long modStamp, final long timeStamp) throws IOException { final File ioFile = convertToIOFileAndCheck(file); @SuppressWarnings("IOResourceOpenedButNotSafelyClosed") final OutputStream stream = shallUseSafeStream(requestor, file) ? new SafeFileOutputStream(ioFile, SystemInfo.isUnix) : new FileOutputStream(ioFile); return new BufferedOutputStream(stream) { @Override public void close() throws IOException { super.close(); if (timeStamp > 0 && ioFile.exists()) { if (!ioFile.setLastModified(timeStamp)) { LOG.warn("Failed: " + ioFile.getPath() + ", new:" + timeStamp + ", old:" + ioFile.lastModified()); } } } }; }
@Override @Nonnull public OutputStream getOutputStream(@Nonnull VirtualFile file, Object requestor, long modStamp, final long timeStamp) throws IOException { final File ioFile = convertToIOFileAndCheck(file); @SuppressWarnings("IOResourceOpenedButNotSafelyClosed") final OutputStream stream = shallUseSafeStream(requestor, file) ? new SafeFileOutputStream(ioFile, SystemInfo.isUnix) : new FileOutputStream(ioFile); return new BufferedOutputStream(stream) { @Override public void close() throws IOException { super.close(); if (timeStamp > 0 && ioFile.exists()) { if (!ioFile.setLastModified(timeStamp)) { LOG.warn("Failed: " + ioFile.getPath() + ", new:" + timeStamp + ", old:" + ioFile.lastModified()); } } } }; }