android.util.Base64 encode/decode flags parameter

后端 未结 2 1078
北海茫月
北海茫月 2021-02-20 02:31

According to the Javadoc, android.util.Base64.decode() takes two parameters: the text, and \"flags\". These flags are in int form and (I quote):

flags controls ce

相关标签:
2条回答
  • 2021-02-20 02:48

    For kotlin you can use

    val flag = Base64.URL_SAFE or Base64.NO_WRAP
    
    0 讨论(0)
  • 2021-02-20 02:57

    int flags passed to functions are usually defined to be bitwise ORed to achieve a combined effect.

    You can usually tell by looking at the constant values, they would go 0 1 2 4 8 16 ..

    As for your question you can use the following for your flag definition:

    int flags = Base64.NO_WRAP | Base64.URL_SAFE;
    
    0 讨论(0)
提交回复
热议问题