aboutsummaryrefslogtreecommitdiffhomepage
path: root/platform_tools/android/apps/canvasproof/src/main/jni/JavaInputStream.h
blob: e14e026552c44c9f080aaf2b7c9e421f236d9085 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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