@Test(expected=SdpException.class) public void testParseInvalidPortFormat() throws SdpException { String line = "m=64534 xyz RTP/AVPF 0 101 120\n\r"; parser.parse(line); }
@Override public MediaDescriptionField parse(String sdp) throws SdpException { try { String[] values = sdp.trim().substring(2).split(" "); int index = 0; int maxIndex = values.length - 1; String media = values[index++]; int port = Integer.parseInt(values[index++]); String protocol = values[index++]; String[] formats = null; if (maxIndex - index >= 0) { int numFormats = maxIndex - index + 1; formats = new String[numFormats]; for (int i = 0; i < numFormats; i++) { formats[i] = values[i + index]; } } MediaDescriptionField md = new MediaDescriptionField(); md.setMedia(media); md.setPort(port); md.setProtocol(protocol); md.setPayloadTypes(formats); return md; } catch (Exception e) { throw new SdpException(PARSE_ERROR + sdp, e); } }
MediaDescriptionFieldParser implements SdpParser<MediaDescriptionField> { @Override public MediaDescriptionField parse(String sdp) throws SdpException { try { String[] values = sdp.trim().substring(2).split(" "); int index = 0; int maxIndex = values.length - 1; String media = values[index++]; int port = Integer.parseInt(values[index++]); String protocol = values[index++]; String[] formats = null; if (maxIndex - index >= 0) { int numFormats = maxIndex - index + 1; formats = new String[numFormats]; for (int i = 0; i < numFormats; i++) { formats[i] = values[i + index]; } } MediaDescriptionField md = new MediaDescriptionField(); md.setMedia(media); md.setPort(port); md.setProtocol(protocol); md.setPayloadTypes(formats); return md; } catch (Exception e) { throw new SdpException(PARSE_ERROR + sdp, e); } } }
MediaDescriptionFieldParser implements SdpParser<MediaDescriptionField> { @Override public MediaDescriptionField parse(String sdp) throws SdpException { try { String[] values = sdp.trim().substring(2).split(" "); int index = 0; int maxIndex = values.length - 1; String media = values[index++]; int port = Integer.parseInt(values[index++]); String protocol = values[index++]; String[] formats = null; if (maxIndex - index >= 0) { int numFormats = maxIndex - index + 1; formats = new String[numFormats]; for (int i = 0; i < numFormats; i++) { formats[i] = values[i + index]; } } MediaDescriptionField md = new MediaDescriptionField(); md.setMedia(media); md.setPort(port); md.setProtocol(protocol); md.setPayloadTypes(formats); return md; } catch (Exception e) { throw new SdpException(PARSE_ERROR + sdp, e); } }  }
MediaDescriptionFieldParser implements SdpParser<MediaDescriptionField> { @Override public MediaDescriptionField parse(String sdp) throws SdpException { try { String[] values = sdp.trim().substring(2).split(" "); int index = 0; int maxIndex = values.length - 1; String media = values[index++]; int port = Integer.parseInt(values[index++]); String protocol = values[index++]; String[] formats = null; if (maxIndex - index >= 0) { int numFormats = maxIndex - index + 1; formats = new String[numFormats]; for (int i = 0; i < numFormats; i++) { formats[i] = values[i + index]; } } MediaDescriptionField md = new MediaDescriptionField(); md.setMedia(media); md.setPort(port); md.setProtocol(protocol); md.setPayloadTypes(formats); return md; } catch (Exception e) { throw new SdpException(PARSE_ERROR + sdp, e); } }  @Override boolean canParse(String sdp); @Override MediaDescriptionField parse(String sdp); @Override void parse(MediaDescriptionField field, String sdp); }
MediaDescriptionFieldParser implements SdpParser<MediaDescriptionField> { @Override public MediaDescriptionField parse(String sdp) throws SdpException { try { String[] values = sdp.trim().substring(2).split(" "); int index = 0; int maxIndex = values.length - 1; String media = values[index++]; int port = Integer.parseInt(values[index++]); String protocol = values[index++]; String[] formats = null; if (maxIndex - index >= 0) { int numFormats = maxIndex - index + 1; formats = new String[numFormats]; for (int i = 0; i < numFormats; i++) { formats[i] = values[i + index]; } } MediaDescriptionField md = new MediaDescriptionField(); md.setMedia(media); md.setPort(port); md.setProtocol(protocol); md.setPayloadTypes(formats); return md; } catch (Exception e) { throw new SdpException(PARSE_ERROR + sdp, e); } }  @Override boolean canParse(String sdp); @Override MediaDescriptionField parse(String sdp); @Override void parse(MediaDescriptionField field, String sdp);  }