public static PyCode compile_flags(String data, String filename,
String type,CompilerFlags cflags)
{
/*
* return Py.compile_flags(
* new java.io.StringBufferInputStream(data+"\n\n"),
* filename, type,cflags);
*/
data += "\n";
InputStream is = null;
/* use JAVA VM's default file encoding */
String encoding = System.getProperty("file.encoding");
if(encoding != null){
try {
is = new ByteArrayInputStream(data.getBytes(encoding));
} catch(UnsupportedEncodingException ex){ }
}
if(is == null){
is = new ByteArrayInputStream(data.getBytes());
}
return Py.compile_flags(is, filename, type, cflags);
}
|