Skip to content

Commit

Permalink
feat(reader): Improved error correction
Browse files Browse the repository at this point in the history
Add policies to control reading behavior. Implement techniques to
support files with erroneous data.
  • Loading branch information
wyskoj committed Jul 9, 2024
1 parent b77d4aa commit 8f8f565
Show file tree
Hide file tree
Showing 3 changed files with 430 additions and 137 deletions.
3 changes: 3 additions & 0 deletions src/commonMain/kotlin/org/wysko/kmidi/ArrayInputStream.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ internal class ArrayInputStream(
var position = 0
private set

val available: Int
get() = bytes.size - position

fun read(): Byte = if (position < bytes.size) bytes[position++] else throw UnexpectedEndOfFileException()

fun readWord(): Short = (read().toShort() shl 8) or read()
Expand Down
Loading

0 comments on commit 8f8f565

Please sign in to comment.