Skip to content

Instantly share code, notes, and snippets.

@volgar1x
Created September 11, 2013 17:11
Show Gist options
  • Save volgar1x/6526721 to your computer and use it in GitHub Desktop.
Save volgar1x/6526721 to your computer and use it in GitHub Desktop.
val dataBuilder = StringBuilder.newBuilder
session.bufferOption match {
case Some(buffer) =>
dataBuilder ++= buffer.result().mkString
buffer.clear()
case _ =>
}
o match {
case str: String =>
dataBuilder ++= str
case buf: ByteBuffer =>
dataBuilder ++= (charset decode buf).toString
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment