/** Reads the entire file into a string using the platform's default charset. * @throw RuntimeException if the file handle represents a directory, doesn't exist, or could not be read. */ public String readString () { return readString(null); }
/** Reads the entire file into a string using the platform's default charset. * @throw RuntimeException if the file handle represents a directory, doesn't exist, or could not be read. */ public String readString () { return readString(null); }
FileDescriptor file = new FileDescriptor(fileName); if (file.exists()) { String[] content = file.readString().split("\n"); if (lineNumber < content.length) { for (int i = lineNumber; i >= 0; i--) {
FileDescriptor file = new FileDescriptor(fileName); if (file.exists()) { String[] content = file.readString().split("\n"); if (lineNumber < content.length) { for (int i = lineNumber; i >= 0; i--) {
new AndroidNdkScriptGenerator().generate(config, target); String template = new FileDescriptor("com/badlogic/gdx/jnigen/resources/scripts/build-android.xml.template", FileType.Classpath).readString(); template = template.replace("%precompile%", target.preCompileTask == null ? "" : target.preCompileTask); template = template.replace("%postcompile%", target.postCompileTask == null ? "" : target.postCompileTask); if (target.os == TargetOs.IOS) { template = new FileDescriptor("com/badlogic/gdx/jnigen/resources/scripts/build-ios.xml.template", FileType.Classpath) .readString(); } else { template = new FileDescriptor("com/badlogic/gdx/jnigen/resources/scripts/build-target.xml.template", FileType.Classpath) .readString();
new AndroidNdkScriptGenerator().generate(config, target); String template = new FileDescriptor("com/badlogic/gdx/jnigen/resources/scripts/build-android.xml.template", FileType.Classpath).readString(); template = template.replace("%precompile%", target.preCompileTask == null ? "" : target.preCompileTask); template = template.replace("%postcompile%", target.postCompileTask == null ? "" : target.postCompileTask); if (target.os == TargetOs.IOS) { template = new FileDescriptor("com/badlogic/gdx/jnigen/resources/scripts/build-ios.xml.template", FileType.Classpath) .readString(); } else { template = new FileDescriptor("com/badlogic/gdx/jnigen/resources/scripts/build-target.xml.template", FileType.Classpath) .readString();
FileType.Classpath).readString(), false); .readString();
FileType.Classpath).readString(), false); .readString();
.readString(); StringBuilder clean = new StringBuilder(); StringBuilder compile = new StringBuilder();
.readString(); StringBuilder clean = new StringBuilder(); StringBuilder compile = new StringBuilder();
private void generateCppFile (ArrayList<JavaSegment> javaSegments, FileDescriptor hFile, FileDescriptor cppFile) throws Exception { String headerFileContent = hFile.readString(); ArrayList<CMethod> cMethods = cMethodParser.parse(headerFileContent).getMethods(); StringBuffer buffer = new StringBuffer(); emitHeaderInclude(buffer, hFile.name()); for (JavaSegment segment : javaSegments) { if (segment instanceof JniSection) { emitJniSection(buffer, (JniSection)segment); } if (segment instanceof JavaMethod) { JavaMethod javaMethod = (JavaMethod)segment; if (javaMethod.getNativeCode() == null) { throw new RuntimeException("Method '" + javaMethod.getName() + "' has no body"); } CMethod cMethod = findCMethod(javaMethod, cMethods); if (cMethod == null) throw new RuntimeException("Couldn't find C method for Java method '" + javaMethod.getClassName() + "#" + javaMethod.getName() + "'"); emitJavaMethod(buffer, javaMethod, cMethod); } } cppFile.writeString(buffer.toString(), false, "UTF-8"); }
private void generateCppFile (ArrayList<JavaSegment> javaSegments, FileDescriptor hFile, FileDescriptor cppFile) throws Exception { String headerFileContent = hFile.readString(); ArrayList<CMethod> cMethods = cMethodParser.parse(headerFileContent).getMethods(); StringBuffer buffer = new StringBuffer(); emitHeaderInclude(buffer, hFile.name()); for (JavaSegment segment : javaSegments) { if (segment instanceof JniSection) { emitJniSection(buffer, (JniSection)segment); } if (segment instanceof JavaMethod) { JavaMethod javaMethod = (JavaMethod)segment; if (javaMethod.getNativeCode() == null) { throw new RuntimeException("Method '" + javaMethod.getName() + "' has no body"); } CMethod cMethod = findCMethod(javaMethod, cMethods); if (cMethod == null) throw new RuntimeException("Couldn't find C method for Java method '" + javaMethod.getClassName() + "#" + javaMethod.getName() + "'"); emitJavaMethod(buffer, javaMethod, cMethod); } } cppFile.writeString(buffer.toString(), false, "UTF-8"); }
continue; String javaContent = file.readString(); if (javaContent.contains(JNI_METHOD_MARKER)) { ArrayList<JavaSegment> javaSegments = javaMethodParser.parse(javaContent);
continue; String javaContent = file.readString(); if (javaContent.contains(JNI_METHOD_MARKER)) { ArrayList<JavaSegment> javaSegments = javaMethodParser.parse(javaContent);
/** Reads the entire file into a string using the platform's default charset. * @throw RuntimeException if the file handle represents a directory, doesn't exist, or could not be read. */ public String readString () { return readString(null); }
FileDescriptor file = new FileDescriptor(fileName); if (file.exists()) { String[] content = file.readString().split("\n"); if (lineNumber < content.length) { for (int i = lineNumber; i >= 0; i--) {
new AndroidNdkScriptGenerator().generate(config, target); String template = new FileDescriptor("com/badlogic/gdx/jnigen/resources/scripts/build-android.xml.template", FileType.Classpath).readString(); template = template.replace("%precompile%", target.preCompileTask == null ? "" : target.preCompileTask); template = template.replace("%postcompile%", target.postCompileTask == null ? "" : target.postCompileTask); if (target.os == TargetOs.IOS) { template = new FileDescriptor("com/badlogic/gdx/jnigen/resources/scripts/build-ios.xml.template", FileType.Classpath) .readString(); } else { template = new FileDescriptor("com/badlogic/gdx/jnigen/resources/scripts/build-target.xml.template", FileType.Classpath) .readString();
FileType.Classpath).readString(), false); .readString();
private void generateCppFile (ArrayList<JavaSegment> javaSegments, FileDescriptor hFile, FileDescriptor cppFile) throws Exception { String headerFileContent = hFile.readString(); ArrayList<CMethod> cMethods = cMethodParser.parse(headerFileContent).getMethods(); StringBuffer buffer = new StringBuffer(); emitHeaderInclude(buffer, hFile.name()); for (JavaSegment segment : javaSegments) { if (segment instanceof JniSection) { emitJniSection(buffer, (JniSection)segment); } if (segment instanceof JavaMethod) { JavaMethod javaMethod = (JavaMethod)segment; if (javaMethod.getNativeCode() == null) { throw new RuntimeException("Method '" + javaMethod.getName() + "' has no body"); } CMethod cMethod = findCMethod(javaMethod, cMethods); if (cMethod == null) throw new RuntimeException("Couldn't find C method for Java method '" + javaMethod.getClassName() + "#" + javaMethod.getName() + "'"); emitJavaMethod(buffer, javaMethod, cMethod); } } cppFile.writeString(buffer.toString(), false, "UTF-8"); }
continue; String javaContent = file.readString(); if (javaContent.contains(JNI_METHOD_MARKER)) { ArrayList<JavaSegment> javaSegments = javaMethodParser.parse(javaContent);