launcher/src/main/java/org/apidesign/bck2brwsr/dew/JFO.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Tue, 15 Jan 2013 22:48:17 +0100
branchdew
changeset 462 aa69b1387624
permissions -rw-r--r--
Trying to compile Java source via the javax.tools.ToolProvider.getSystemJavaCompiler
     1 /*
     2  * To change this template, choose Tools | Templates
     3  * and open the template in the editor.
     4  */
     5 package org.apidesign.bck2brwsr.dew;
     6 
     7 import java.io.IOException;
     8 import java.io.InputStream;
     9 import java.io.OutputStream;
    10 import java.io.Reader;
    11 import java.io.StringReader;
    12 import java.io.Writer;
    13 import java.net.URI;
    14 import javax.lang.model.element.Modifier;
    15 import javax.lang.model.element.NestingKind;
    16 import javax.tools.JavaFileObject;
    17 
    18 /**
    19  *
    20  * @author Jaroslav Tulach <jtulach@netbeans.org>
    21  */
    22 final class JFO implements JavaFileObject {
    23     private final String text;
    24     private final String name;
    25 
    26     public JFO(String text, String name) {
    27         this.text = text;
    28         this.name = name;
    29     }
    30 
    31     @Override
    32     public Kind getKind() {
    33         return Kind.SOURCE;
    34     }
    35 
    36     @Override
    37     public boolean isNameCompatible(String simpleName, Kind kind) {
    38         return false;
    39     }
    40 
    41     @Override
    42     public NestingKind getNestingKind() {
    43         throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    44     }
    45 
    46     @Override
    47     public Modifier getAccessLevel() {
    48         throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    49     }
    50 
    51     @Override
    52     public URI toUri() {
    53         throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    54     }
    55 
    56     @Override
    57     public String getName() {
    58         return name;
    59     }
    60 
    61     @Override
    62     public InputStream openInputStream() throws IOException {
    63         throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    64     }
    65 
    66     @Override
    67     public OutputStream openOutputStream() throws IOException {
    68         throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    69     }
    70 
    71     @Override
    72     public Reader openReader(boolean ignoreEncodingErrors) throws IOException {
    73         return new StringReader(text);
    74     }
    75 
    76     @Override
    77     public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
    78         return text;
    79     }
    80 
    81     @Override
    82     public Writer openWriter() throws IOException {
    83         throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    84     }
    85 
    86     @Override
    87     public long getLastModified() {
    88         throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    89     }
    90 
    91     @Override
    92     public boolean delete() {
    93         throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    94     }
    95     
    96 }