Kotlin copy file

You can’t assing a variable during expression in kotlin (take a look at: Assignment not allow in while expression?)

Try that:

var length = inStream.read(buffer)

while (length > 0) {
	outStream.write(buffer, 0, length)
	length = inStream.read(buffer)
}