1 11 12 package org.eclipse.jdt.internal.apt.pluggable.core.filer; 13 14 import java.io.IOException ; 15 import java.io.InputStream ; 16 import java.io.OutputStream ; 17 import java.io.PrintWriter ; 18 import java.io.Reader ; 19 import java.io.Writer ; 20 import java.net.URI ; 21 import java.util.Collection ; 22 import java.util.Set ; 23 24 import javax.tools.FileObject; 25 import javax.tools.JavaFileManager.Location; 26 27 import org.eclipse.core.resources.IFile; 28 import org.eclipse.jdt.internal.apt.pluggable.core.dispatch.IdeProcessingEnvImpl; 29 30 38 public class IdeOutputFileObject implements FileObject 39 { 40 private final IdeProcessingEnvImpl _env; 41 private final IFile _file; 42 private final Collection <IFile> _parentFiles; 43 44 45 54 public IdeOutputFileObject(IdeProcessingEnvImpl env, IFile file, Set <IFile> parentFiles) { 55 _env = env; 56 _file = file; 57 _parentFiles = parentFiles; 58 } 59 60 63 @Override 64 public boolean delete() 65 { 66 throw new UnsupportedOperationException ("Deleting a generated file is not permitted"); 67 } 68 69 72 @Override 73 public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException 74 { 75 throw new UnsupportedOperationException ("Reading a generated file is not permitted"); 76 } 77 78 81 @Override 82 public long getLastModified() 83 { 84 throw new UnsupportedOperationException ("Not yet implemented"); 85 } 86 87 90 @Override 91 public String getName() 92 { 93 throw new UnsupportedOperationException ("Not yet implemented"); 95 } 96 97 100 @Override 101 public InputStream openInputStream() throws IOException 102 { 103 throw new UnsupportedOperationException ("Reading a generated file is not permitted"); 104 } 105 106 109 @Override 110 public OutputStream openOutputStream() throws IOException 111 { 112 return new IdeNonSourceOutputStream(_env, _file, _parentFiles); 113 } 114 115 118 @Override 119 public Reader openReader(boolean ignoreEncodingErrors) throws IOException 120 { 121 throw new UnsupportedOperationException ("Reading a generated file is not permitted"); 122 } 123 124 127 @Override 128 public Writer openWriter() throws IOException 129 { 130 return new PrintWriter (openOutputStream()); 131 } 132 133 136 @Override 137 public URI toUri() 138 { 139 throw new UnsupportedOperationException ("Not yet implemented"); 141 } 142 143 } 144 | Popular Tags |