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
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.