private static int readLength(@NonNull SocketChannel socket,@NonNull byte[] buffer) throws IOException {
  String msg=read(socket,buffer);
  if (msg != null) {
    try {
      return Integer.parseInt(msg,16);
    }
 catch (    NumberFormatException nfe) {
    }
  }
  throw new IOException("Unable to read length");
}

private static int readLength ( @ NonNull SocketChannel socket , @ NonNull byte [ ] buffer ) throws IOException { String msg = read ( socket , buffer ) ; if ( msg != null ) { try { return Integer . parseInt ( msg , 16 ) ; } catch ( NumberFormatException nfe ) { } } throw new IOException ( "Unable to read length" ) ; }
reads the length of the next message from a socket .
