저는 이미지 바이트 데이터를 서명되지 않은 문자 배열에 저장하는 C++ 라이브러리를 사용하고 있습니다. 내 jni 함수는 jByteArray (자바 측에서 BufferedImage로 변환 됨)를 반환하지만 가능한 경우 서명되지 않은 문자 배열에서 jByteArray를 채우는 방법을 모르겠습니다. 사람은 기본적으로이 작업을 수행하는이 마지막 부분에 대한 미리보기를 제공 할 수JNI unsigned char를 바이트 배열
// size is the size of the unsigned char array
const int size = 100;
unsigned char* buf = new unsigned char[size];
// buf gets passed to another library here to be populated
jbyteArray bArray = env->NewByteArray(size);
// now how do I get the data from buf to bArray?
감사합니다, 제프
나는 조금 혼란스러워. 원래의 서명되지 않은 char 배열 (jarray가 아닌)의 복사는 어디에서 발생합니까? –
수정 된 버전보기 덕분에 – bmargulies
. 도움을 감사하십시오. –