Skip empty lines (#89)

This commit is contained in:
Konstantin Aleev 2025-04-29 14:09:03 +02:00 • committed by GitHub
commit dc5c155761
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View file

@ -24,7 +24,7 @@ public class ReadBuffer {
-1L -> return null
0L -> {
buffer.skip(1)
""
return null
}
else -> {

View file

@ -41,6 +41,13 @@ class ReadBufferTest {
assertNull(readBuffer.readMessage())
}
@Test
fun `skip empty line`() {
val readBuffer = ReadBuffer()
readBuffer.append("\n".toByteArray(StandardCharsets.UTF_8))
assertNull(readBuffer.readMessage())
}
@Test
fun `should be reusable after clearing`() {
val readBuffer = ReadBuffer()