Index: libadblockplus-android/jni/Utils.cpp |
diff --git a/libadblockplus-android/jni/Utils.cpp b/libadblockplus-android/jni/Utils.cpp |
index 282ae5b344ea6640f6a6de8c3daf89e6b8f87f13..b18d91d4d8dc75df0e831780ad40fecd8ea29633 100644 |
--- a/libadblockplus-android/jni/Utils.cpp |
+++ b/libadblockplus-android/jni/Utils.cpp |
@@ -16,6 +16,8 @@ |
*/ |
#include <string> |
+#include <sstream> |
+#include <iostream> |
#include "Utils.h" |
@@ -98,6 +100,16 @@ std::string JniJavaToStdString(JNIEnv* env, jstring str) |
return ret; |
} |
+std::string JniStdStreamToStdString(std::istream *in) |
+{ |
+ std::string ret; |
+ char buffer[1024]; |
+ while (in->read(buffer, sizeof(buffer))) |
+ ret.append(buffer, sizeof(buffer)); |
+ ret.append(buffer, in->gcount()); |
+ return ret; |
+} |
+ |
jstring JniStdStringToJava(JNIEnv* env, std::string str) |
{ |
return env->NewStringUTF(str.c_str()); |