QtAndroidExtras Source: Why some functions get QByteArray parameter?



  • Hi; I saw some functions like this in qjni.cpp:

    static jclass getCachedClass(const QByteArray &classBinEnc, bool *isCached = 0)
    {
      ...
    }
    
    inline static jclass loadClass(const QByteArray &className, JNIEnv *env, bool binEncoded = false)
    {
      ...
    }
    

    I don't know why this functions get QByteArray parameter for class name? Class name can be QString, std::string or const char*? Thanks.



  • maybe because of many diffrient languages (UTF, WIN-1250 ect.).


  • Moderators

    @Artmetic QString is 16bit Unicode, so it can handle different languages and encodings.
    @Ibrahim I'm not JNI expert, but maybe the reason is that Qt needs to communicate with Java (JRE) and QByteArray is just an array of bytes - quite universal.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.