Skip to content

Instantly share code, notes, and snippets.

@volgar1x
Created September 7, 2013 13:34
Show Gist options
  • Save volgar1x/6475606 to your computer and use it in GitHub Desktop.
Save volgar1x/6475606 to your computer and use it in GitHub Desktop.
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