/** * @param value A potential value to be used for Differentiated Services. * @return The corresponding Differentiated Services Code Point (DSCP). * @throws IllegalArgumentException if the value does not correspond to a * Differentiated Services Code Point or setting the DSCP is not * supported. */ public static int getDSCP(String value) throws IllegalArgumentException { int intValue = -1; // Check the names first. if (DIFF_SERV_NAMES.containsKey(value)) { intValue = DIFF_SERV_NAMES.get(value); } else { try { intValue = Integer.parseInt(value); if (intValue > MAX_DIFF_SERV || intValue < MIN_DIFF_SERV) { throw new IllegalArgumentException("Differentiated Services" + " value: " + intValue + " not in legal range [" + MIN_DIFF_SERV + ", " + MAX_DIFF_SERV + "]."); } } catch (NumberFormatException e) { // value must have been a malformed name. throw new IllegalArgumentException("No such Differentiated " + "Services name: " + value); } } return adjustDSCPForECN(intValue); }
/** * @param value A potential value to be used for Differentiated Services. * @return The corresponding Differentiated Services Code Point (DSCP). * @throws IllegalArgumentException if the value does not correspond to a * Differentiated Services Code Point or setting the DSCP is not * supported. */ public static int getDSCP(String value) throws IllegalArgumentException { int intValue = -1; // Check the names first. if (DIFF_SERV_NAMES.containsKey(value)) { intValue = DIFF_SERV_NAMES.get(value); } else { try { intValue = Integer.parseInt(value); if (intValue > MAX_DIFF_SERV || intValue < MIN_DIFF_SERV) { throw new IllegalArgumentException("Differentiated Services" + " value: " + intValue + " not in legal range [" + MIN_DIFF_SERV + ", " + MAX_DIFF_SERV + "]."); } } catch (NumberFormatException e) { // value must have been a malformed name. throw new IllegalArgumentException("No such Differentiated " + "Services name: " + value); } } return adjustDSCPForECN(intValue); }
/** * @param value A potential value to be used for Differentiated Services. * @return The corresponding Differentiated Services Code Point (DSCP). * @throws IllegalArgumentException if the value does not correspond to a * Differentiated Services Code Point or setting the DSCP is not * supported. */ public static int getDSCP(String value) throws IllegalArgumentException { int intValue = -1; // Check the names first. if (DIFF_SERV_NAMES.containsKey(value)) { intValue = DIFF_SERV_NAMES.get(value); } else { try { intValue = Integer.parseInt(value); if (intValue > MAX_DIFF_SERV || intValue < MIN_DIFF_SERV) { throw new IllegalArgumentException("Differentiated Services" + " value: " + intValue + " not in legal range [" + MIN_DIFF_SERV + ", " + MAX_DIFF_SERV + "]."); } } catch (NumberFormatException e) { // value must have been a malformed name. throw new IllegalArgumentException("No such Differentiated " + "Services name: " + value); } } return adjustDSCPForECN(intValue); }
/** * @param value A potential value to be used for Differentiated Services. * @return The corresponding Differentiated Services Code Point (DSCP). * @throws IllegalArgumentException if the value does not correspond to a * Differentiated Services Code Point or setting the DSCP is not * supported. */ public static int getDSCP(String value) throws IllegalArgumentException { int intValue = -1; // Check the names first. if (DIFF_SERV_NAMES.containsKey(value)) { intValue = DIFF_SERV_NAMES.get(value); } else { try { intValue = Integer.parseInt(value); if (intValue > MAX_DIFF_SERV || intValue < MIN_DIFF_SERV) { throw new IllegalArgumentException("Differentiated Services" + " value: " + intValue + " not in legal range [" + MIN_DIFF_SERV + ", " + MAX_DIFF_SERV + "]."); } } catch (NumberFormatException e) { // value must have been a malformed name. throw new IllegalArgumentException("No such Differentiated " + "Services name: " + value); } } return adjustDSCPForECN(intValue); }
/** * @param value A potential value to be used for Differentiated Services. * @return The corresponding Differentiated Services Code Point (DSCP). * @throws IllegalArgumentException if the value does not correspond to a * Differentiated Services Code Point or setting the DSCP is not * supported. */ public static int getDSCP(String value) throws IllegalArgumentException { int intValue = -1; // Check the names first. if (DIFF_SERV_NAMES.containsKey(value)) { intValue = DIFF_SERV_NAMES.get(value); } else { try { intValue = Integer.parseInt(value); if (intValue > MAX_DIFF_SERV || intValue < MIN_DIFF_SERV) { throw new IllegalArgumentException("Differentiated Services" + " value: " + intValue + " not in legal range [" + MIN_DIFF_SERV + ", " + MAX_DIFF_SERV + "]."); } } catch (NumberFormatException e) { // value must have been a malformed name. throw new IllegalArgumentException("No such Differentiated " + "Services name: " + value); } } return adjustDSCPForECN(intValue); }