| 266 | public static native long msgHeaders(int blockSize, int count); |
| 267 | |
| 268 | public static int parseIPv4(CharSequence ipv4Address) { |
| 269 | int ip = 0; |
| 270 | int count = 0; |
| 271 | int lo = 0; |
| 272 | int hi; |
| 273 | try { |
| 274 | while ((hi = Chars.indexOf(ipv4Address, lo, '.')) > -1) { |
| 275 | int n = Numbers.parseInt(ipv4Address, lo, hi); |
| 276 | ip = (ip << 8) | n; |
| 277 | count++; |
| 278 | lo = hi + 1; |
| 279 | } |
| 280 | |
| 281 | if (count != 3) { |
| 282 | throw NetworkError.instance(0, "invalid address [").put(ipv4Address).put(']'); |
| 283 | } |
| 284 | |
| 285 | return (ip << 8) | Numbers.parseInt(ipv4Address, lo, ipv4Address.length()); |
| 286 | } catch (NumericException e) { |
| 287 | throw NetworkError.instance(0, "invalid address [").put(ipv4Address).put(']'); |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | public static int peek(long fd, long ptr, int len) { |
| 292 | return peek(toOsFd(fd), ptr, len); |