List of usage examples for org.eclipse.jdt.internal.compiler.tool EclipseFileObject EclipseFileObject
public EclipseFileObject(String className, URI uri, Kind kind, Charset charset)
From source file:de.pavloff.spark4knime.jsnippet.JavaSnippet.java
License:Open Source License
/** * Create the java-file of the snippet.//from w w w .jav a 2 s . c o m */ private JavaFileObject createJSnippetFile() throws IOException { m_snippetFile = new File(m_tempClassPathDir, "JSnippet" + m_uid + ".java"); FileOutputStream fos = new FileOutputStream(m_snippetFile); OutputStreamWriter out = new OutputStreamWriter(fos, Charset.forName("UTF-8")); try { try { Document doc = getDocument(); out.write(doc.getText(0, doc.getLength())); } catch (BadLocationException e) { // this should never happen. throw new IllegalStateException(e); } } finally { out.close(); } return new EclipseFileObject("JSnippet" + m_uid, m_snippetFile.toURI(), Kind.SOURCE, Charset.defaultCharset()); }