Created
March 26, 2015 03:32
-
-
Save codedmart/78ac6ab4f6744073ba83 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
| private def recvAll(accum: Int): Array[Byte] = { | |
| @tailrec def recvAllBuf(response: Array[Byte], acc: Int): Array[Byte] = { | |
| val character = in.read() | |
| val responseArray = response :+ character.toByte | |
| acc match { | |
| case 0 => responseArray | |
| case _ => recvAllBuf(responseArray, acc - 1) | |
| } | |
| } | |
| recvAllBuf(Array[Byte](), accum - 1) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment