Created
September 7, 2013 13:34
-
-
Save volgar1x/6475606 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def decode(buf: ByteBuffer): List[Any] = { | |
val msgs = List.newBuilder[Any] | |
var input = charset.decode(buf).toString | |
breakable { | |
while (true) { | |
val index = input.indexOf(inputDelimiter) | |
if (index < 0) break | |
msgs += input.substring(0, index) | |
input = input.substring(index + inputDelimiter.length) | |
} | |
} | |
if (!input.isEmpty) { | |
session.buffer.write(input) // je sais, il faut la session et il existe surement pas de ByteBuffer.write(String) | |
} | |
msgs.result | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment