Пример #1
0
int ImageSubheader::insertImageComment(std::string comment, int index)
{
    int actualIndex = nitf_ImageSubheader_insertImageComment(getNativeOrThrow(),
                  (char*)comment.c_str(), index, &error);
    if (actualIndex < 0)
        throw nitf::NITFException(&error);
    return actualIndex;
}
Пример #2
0
/*
 * Class:     nitf_ImageSubheader
 * Method:    insertImageComment
 * Signature: (Ljava/lang/String;I)I
 */
JNIEXPORT jint JNICALL Java_nitf_ImageSubheader_insertImageComment
    (JNIEnv * env, jobject self, jstring comment, jint index)
{
    nitf_ImageSubheader *header = _GetObj(env, self);
    nitf_Error error;
    const jbyte *comBuf = NULL;
    jint indexUsed;

    if (comment != NULL)
        comBuf = (*env)->GetStringUTFChars(env, comment, 0);

    indexUsed = nitf_ImageSubheader_insertImageComment(
            header, comBuf, index, &error);
    
    if (indexUsed < 0)
    {
        _ThrowNITFException(env, error.message);
    }
    
    if (comment != NULL)
        (*env)->ReleaseStringUTFChars(env, comment, comBuf);
    
    return indexUsed;
}