package theorycrafter.utils

import java.io.DataInputStream
import java.io.DataOutputStream
import java.io.InputStream
import java.io.OutputStream


/**
 * Skips the given number of bytes in the stream.
 */
expect fun InputStream.skipBytes(count: Long)


/**
 * Reads the entire remaining contents of the stream into a byte array and returns it.
 */
expect fun InputStream.readToEnd(): ByteArray


/**
 * Wraps an input stream in a [DataInputStream].
 */
@Suppress("IfThenToElvis")
fun InputStream.data(): DataInputStream =
    if (this is DataInputStream) this else DataInputStream(this)


/**
 * Wraps an output stream in a [DataOutputStream].
 */
@Suppress("IfThenToElvis")
fun OutputStream.data(): DataOutputStream =
    if (this is DataOutputStream) this else DataOutputStream(this)
