Commit e9b64c83 authored by Him188moe's avatar Him188moe

update

parent 1eae0932
......@@ -96,8 +96,28 @@ fun ByteArray.dataInputStream(): DataInputStream = DataInputStream(this.inputStr
/**
* Reset and skip(position)
*/
fun <N : Number> DataInputStream.goto(position: N): DataInputStream {
infix fun <N : Number> DataInputStream.goto(position: N): DataInputStream {
this.reset()
this.skip(position.toLong());
return this
}
fun <N : Number> DataInputStream.readNBytes(position: N, length: Int): ByteArray {
this.goto(position)
return this.readNBytes(length)
}
fun <N : Number> DataInputStream.readInt(position: N): Int {
this.goto(position)
return this.readInt();
}
fun <N : Number> DataInputStream.readByte(position: N): Byte {
this.goto(position)
return this.readByte();
}
fun <N : Number> DataInputStream.readShort(position: N): Short {
this.goto(position)
return this.readShort();
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment