langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/PathFileObject.java
changeset 35807 2eb1d877da0f
parent 34560 b6a567b677f7
child 37944 1153fab98d25
equal deleted inserted replaced
35739:db483b34fa71 35807:2eb1d877da0f
     1 /*
     1 /*
     2  * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   430         return path.toUri();
   430         return path.toUri();
   431     }
   431     }
   432 
   432 
   433     @Override @DefinedBy(Api.COMPILER)
   433     @Override @DefinedBy(Api.COMPILER)
   434     public InputStream openInputStream() throws IOException {
   434     public InputStream openInputStream() throws IOException {
       
   435         fileManager.updateLastUsedTime();
   435         return Files.newInputStream(path);
   436         return Files.newInputStream(path);
   436     }
   437     }
   437 
   438 
   438     @Override @DefinedBy(Api.COMPILER)
   439     @Override @DefinedBy(Api.COMPILER)
   439     public OutputStream openOutputStream() throws IOException {
   440     public OutputStream openOutputStream() throws IOException {
       
   441         fileManager.updateLastUsedTime();
   440         fileManager.flushCache(this);
   442         fileManager.flushCache(this);
   441         ensureParentDirectoriesExist();
   443         ensureParentDirectoriesExist();
   442         return Files.newOutputStream(path);
   444         return Files.newOutputStream(path);
   443     }
   445     }
   444 
   446 
   469         return cb;
   471         return cb;
   470     }
   472     }
   471 
   473 
   472     @Override @DefinedBy(Api.COMPILER)
   474     @Override @DefinedBy(Api.COMPILER)
   473     public Writer openWriter() throws IOException {
   475     public Writer openWriter() throws IOException {
       
   476         fileManager.updateLastUsedTime();
   474         fileManager.flushCache(this);
   477         fileManager.flushCache(this);
   475         ensureParentDirectoriesExist();
   478         ensureParentDirectoriesExist();
   476         return new OutputStreamWriter(Files.newOutputStream(path), fileManager.getEncodingName());
   479         return new OutputStreamWriter(Files.newOutputStream(path), fileManager.getEncodingName());
   477     }
   480     }
   478 
   481