在Android上加载和执行二进制文件
有没有办法在android应用程序中执行二进制文件。没有JNI包装器方法 请给我示例代码。试试这个在Android上加载和执行二进制文件,android,execute,Android,Execute,有没有办法在android应用程序中执行二进制文件。没有JNI包装器方法 请给我示例代码。试试这个 public void pump(InputStream in, OutputStream out, int size) { byte[] buffer = new byte[4096]; // Or whatever constant you feel like using int done = 0; while (done < size) { int read = in.read
public void pump(InputStream in, OutputStream out, int size) {
byte[] buffer = new byte[4096]; // Or whatever constant you feel like using
int done = 0;
while (done < size) {
int read = in.read(buffer);
if (read == -1) {
throw new IOException("Something went horribly wrong");
}
out.write(buffer, 0, read);
done += read;
}
// Maybe put cleanup code in here if you like, e.g. in.close, out.flush, out.close
}
public void pump(输入流输入、输出流输出、int size){
byte[]buffer=新字节[4096];//或任何您想使用的常量
int done=0;
while(完成<大小){
int read=in.read(缓冲区);
如果(读取==-1){
抛出新IOException(“出现了可怕的错误”);
}
输出。写入(缓冲区,0,读取);
完成+=读取;
}
//如果您愿意,可以在这里输入清理代码,例如in.close、out.flush、out.close
}
从该链接中请参见