Smallville7123
03/30/2019, 12:07 AMimport java.io.File;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
fun fileToByteBuffer(f : File) : ByteBuffer {
val file = RandomAccessFile(f, "r")
val fileChannel = file.getChannel()
var i = 0
var buffer = ByteBuffer.allocate(fileChannel.size().toInt())
fileChannel.read(buffer)
buffer.flip()
return buffer
}
val filetmp = "/sda3_partition_resize_to_size"
class lexer(stm : ByteBuffer, delimiter : String) {
val f = stm
val delimiters = delimiter
fun clone() {
val ll = lexer(fileToByteBuffer(File(filetmp)), "none")
}
}
tasks.register("test") {
val lex = lexer(fileToByteBuffer(File(filetmp)), "none")
println("cloning")
lex.clone()
println("clone sucesfull")
}
app/build.gradle :
apply from: '../a/build.gradle.kts'
preBuild.dependsOn test
Executing tasks: [assemble]
> Configure project :app
cloning
FAILURE: Build failed with an exception.
* Where:
Build file '/home/macropreprocessor/AndroidStudioProjects/kpp/app/build.gradle' line: 35
* What went wrong:
A problem occurred evaluating project ':app'.
> Could not create task ':app:test'.
> Build_gradle$lexer.<init>(Ljava/nio/ByteBuffer;Ljava/lang/String;)V
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at <https://help.gradle.org>
BUILD FAILED in 1s