org.objectweb.fractal.juliac.compile.jdk6.JavaSourceFromString Maven / Gradle / Ivy
The newest version!
/***
* Juliac
* Copyright (C) 2009-2013 Inria, Univ. Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact: [email protected]
*
* Author: Lionel Seinturier
*/
package org.objectweb.fractal.juliac.compile.jdk6;
import java.net.URI;
import javax.tools.SimpleJavaFileObject;
/**
* Implementation of the {@link javax.tools.JavaFileObject} interface with the
* content of the file stored in a string.
*
* @author Lionel Seinturier
* @since 2.2.3
*/
public class JavaSourceFromString extends SimpleJavaFileObject {
private String code;
public JavaSourceFromString( String fileName, char[] code ) {
super( URI.create(fileName), Kind.SOURCE );
this.code = new String(code);
}
@Override
public CharSequence getCharContent( boolean ignoreEncodingErrors ) {
return code;
}
}