Assignments are not expressions - Kotlin

前端 未结 2 476
醉酒成梦
醉酒成梦 2020-12-21 10:09

I\'m refactoring my project built with Java to Kotlin and to copy database from sqlite assets table I\'m doing this and it works correctly.

private void copy         


        
相关标签:
2条回答
  • 2020-12-21 10:23

    Change it to:

     mLength = mInput.read(mBuffer)
     while (mLength > 0) { 
            mOutput.write(mBuffer, 0, mLength)
            mLength = mInput.read(mBuffer)
        }
    
    0 讨论(0)
  • 2020-12-21 10:36

    This is a work around to your problem:

    while ({mLength = mInput.read(mBuffer); mLength}() > 0) {
        mOutput.write(mBuffer, 0, mLength)
    }
    

    For further detail read this discussion.

    0 讨论(0)
提交回复
热议问题