Open-source multiplayer game server compatible with the RuneScape client
https://www.openrs2.org/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
600 B
23 lines
600 B
package dev.openrs2.common.io
|
|
|
|
import java.io.FilterOutputStream
|
|
import java.io.OutputStream
|
|
|
|
class SkipOutputStream(out: OutputStream, private var skipBytes: Long) : FilterOutputStream(out) {
|
|
override fun write(b: Int) {
|
|
if (skipBytes == 0L) {
|
|
super.write(b)
|
|
} else {
|
|
skipBytes--
|
|
}
|
|
}
|
|
|
|
override fun write(b: ByteArray, off: Int, len: Int) {
|
|
if (len >= skipBytes) {
|
|
super.write(b, off + skipBytes.toInt(), len - skipBytes.toInt())
|
|
skipBytes = 0
|
|
} else {
|
|
skipBytes -= len
|
|
}
|
|
}
|
|
}
|
|
|