langtools/src/share/classes/com/sun/tools/javac/file/RegularFileObject.java
changeset 3782 ae62279eeb46
parent 3380 a6c2bcab0fec
child 3995 73af8b6fb8bc
child 3890 b53fced26fa4
equal deleted inserted replaced
3781:cad98ced28c5 3782:ae62279eeb46
    32 import java.io.InputStream;
    32 import java.io.InputStream;
    33 import java.io.OutputStream;
    33 import java.io.OutputStream;
    34 import java.io.OutputStreamWriter;
    34 import java.io.OutputStreamWriter;
    35 import java.io.Writer;
    35 import java.io.Writer;
    36 import java.net.URI;
    36 import java.net.URI;
    37 import java.net.URISyntaxException;
       
    38 import java.nio.ByteBuffer;
    37 import java.nio.ByteBuffer;
    39 import java.nio.CharBuffer;
    38 import java.nio.CharBuffer;
    40 import java.nio.charset.CharsetDecoder;
    39 import java.nio.charset.CharsetDecoder;
    41 import javax.tools.JavaFileObject;
    40 import javax.tools.JavaFileObject;
    42 
    41 
    71 
    70 
    72     public InputStream openInputStream() throws IOException {
    71     public InputStream openInputStream() throws IOException {
    73         return new FileInputStream(f);
    72         return new FileInputStream(f);
    74     }
    73     }
    75 
    74 
       
    75     @Override
    76     protected CharsetDecoder getDecoder(boolean ignoreEncodingErrors) {
    76     protected CharsetDecoder getDecoder(boolean ignoreEncodingErrors) {
    77         return fileManager.getDecoder(fileManager.getEncodingName(), ignoreEncodingErrors);
    77         return fileManager.getDecoder(fileManager.getEncodingName(), ignoreEncodingErrors);
    78     }
    78     }
    79 
    79 
    80     public OutputStream openOutputStream() throws IOException {
    80     public OutputStream openOutputStream() throws IOException {
   145         }
   145         }
   146         return false;
   146         return false;
   147     }
   147     }
   148 
   148 
   149     @Deprecated
   149     @Deprecated
       
   150     @Override
   150     public String getPath() {
   151     public String getPath() {
   151         return f.getPath();
   152         return f.getPath();
   152     }
   153     }
   153 
   154 
   154     public long getLastModified() {
   155     public long getLastModified() {
   199     public int hashCode() {
   200     public int hashCode() {
   200         return f.hashCode();
   201         return f.hashCode();
   201     }
   202     }
   202 
   203 
   203     public URI toUri() {
   204     public URI toUri() {
   204         try {
   205         return f.toURI().normalize();
   205             String path = f.getAbsolutePath().replace(File.separatorChar, '/');
       
   206             return new URI("file://" + path).normalize();
       
   207         } catch (URISyntaxException ex) {
       
   208             return f.toURI();
       
   209         }
       
   210     }
   206     }
   211 }
   207 }