Advertisement
bingoohuang

Untitled

Mar 13th, 2014
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.23 KB | None | 0 0
  1.   def readShortString(buffer: ByteBuffer): String = {
  2.     val size: Int = buffer.getShort()
  3.     if(size < 0)
  4.       return null
  5.     val bytes = new Array[Byte](size)
  6.     buffer.get(bytes)
  7.     new String(bytes, ProtocolEncoding)
  8.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement