(final InputStream in, final int numBytes)
| 29 | */ |
| 30 | class Utils { |
| 31 | public static byte[] recvAll(final InputStream in, final int numBytes) throws IOException { |
| 32 | byte[] res = new byte[numBytes]; |
| 33 | int numRead = 0; |
| 34 | while (numRead < numBytes) { |
| 35 | int chunk = in.read(res, numRead, Math.min(numBytes - numRead, 1024)); |
| 36 | numRead += chunk; |
| 37 | } |
| 38 | return res; |
| 39 | } |
| 40 | |
| 41 | public static void closeQuietly(Socket socket) { |
| 42 | if (socket != null) { |
no test coverage detected