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
Change it to:
mLength = mInput.read(mBuffer)
while (mLength > 0) {
mOutput.write(mBuffer, 0, mLength)
mLength = mInput.read(mBuffer)
}
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.