Index: platform_tools/android/apps/canvasproof/src/main/jni/JavaInputStream.h |
diff --git a/platform_tools/android/apps/canvasproof/src/main/jni/JavaInputStream.h b/platform_tools/android/apps/canvasproof/src/main/jni/JavaInputStream.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e14e026552c44c9f080aaf2b7c9e421f236d9085 |
--- /dev/null |
+++ b/platform_tools/android/apps/canvasproof/src/main/jni/JavaInputStream.h |
@@ -0,0 +1,28 @@ |
+/* |
+ * Copyright 2015 Google Inc. |
+ * |
+ * Use of this source code is governed by a BSD-style license that can be |
+ * found in the LICENSE file. |
+ */ |
+#ifndef JavaInputStream_DEFINED |
+#define JavaInputStream_DEFINED |
+ |
+#include <jni.h> |
+#include "SkStream.h" |
+ |
+class JavaInputStream : public SkStream { |
+public: |
+ JavaInputStream(JNIEnv*, jbyteArray javaBuffer, jobject javaIoInputStream); |
+ bool isAtEnd() const override; |
+ size_t read(void*, size_t) override; |
+private: |
+ JNIEnv* fEnv; |
+ jobject fInputStream; |
+ jbyteArray fJavaBuffer; |
+ jclass fInputStreamClass; |
+ jmethodID fReadMethodID; |
+ jint fStartIndex; |
+ jint fEndIndex; |
+}; |
+ |
+#endif // JavaInputStream_DEFINED |