@Override public int hashCode() { int result = protocol.hashCode(); result = 31 * result + network.hashCode(); result = 31 * result + contentFormat.hashCode(); result = 31 * result + additionalInfo.hashCode(); return result; }
public ProtocolInfo(String s) throws InvalidValueException { if (s == null) throw new NullPointerException(); s = s.trim(); String[] split = s.split(":"); if (split.length != 4) { throw new InvalidValueException("Can't parse ProtocolInfo string: " + s); } this.protocol = Protocol.value(split[0]); this.network = split[1]; this.contentFormat = split[2]; this.additionalInfo = split[3]; }
@Override public String toString() { return protocol.toString() + ":" + network + ":" + contentFormat + ":" + additionalInfo; } }
protected boolean isProtocolInfoMatch(List<ProtocolInfo> supportedProtocols, Res resource) { ProtocolInfo resourceProtocolInfo = resource.getProtocolInfo(); if (!resourceProtocolInfo.getProtocol().equals(Protocol.HTTP_GET)) return false; MimeType resourceMimeType; try { resourceMimeType = resourceProtocolInfo.getContentFormatMimeType(); } catch (IllegalArgumentException ex) { ContentDirectoryControlPoint.LOGGER.warning( "Illegal resource mime type: " + resourceProtocolInfo.getContentFormat() ); return false; } for (ProtocolInfo supportedProtocol : supportedProtocols) { // We currently only support HTTP-GET if (!Protocol.HTTP_GET.equals(supportedProtocol.getProtocol())) continue; try { if (supportedProtocol.getContentFormatMimeType().equals(resourceMimeType)) { return true; } else if (supportedProtocol.getContentFormatMimeType().isCompatible(resourceMimeType)) { return true; } } catch (IllegalArgumentException ex) { ContentDirectoryControlPoint.LOGGER.warning( "Illegal MediaRenderer supported mime type: " + supportedProtocol.getContentFormat() ); } } return false; }
public ProtocolInfo(String s) throws InvalidValueException { if (s == null) throw new NullPointerException(); s = s.trim(); String[] split = s.split(":"); //TODO //XGF // if (split.length != 4) { // throw new InvalidValueException("Can't parse ProtocolInfo string: " + // s); // } this.protocol = Protocol.valueOrNullOf(split[0]); this.network = split[1]; this.contentFormat = split[2]; if (split.length == 4) { this.additionalInfo = split[3]; } }
@Override public String toString() { return protocol.toString() + ":" + network + ":" + contentFormat + ":" + additionalInfo; } }
@Override public int hashCode() { int result = protocol.hashCode(); result = 31 * result + network.hashCode(); result = 31 * result + contentFormat.hashCode(); result = 31 * result + additionalInfo.hashCode(); return result; }
@Override public String toString() { return protocol.toString() + ":" + network + ":" + contentFormat + ":" + additionalInfo; } }
public ProtocolInfo(String s) throws InvalidValueException { if (s == null) throw new NullPointerException(); s = s.trim(); String[] split = s.split(":"); if (split.length != 4) { throw new InvalidValueException("Can't parse ProtocolInfo string: " + s); } this.protocol = Protocol.value(split[0]); this.network = split[1]; this.contentFormat = split[2]; this.additionalInfo = split[3]; }
@Override public int hashCode() { int result = protocol.hashCode(); result = 31 * result + network.hashCode(); result = 31 * result + contentFormat.hashCode(); result = 31 * result + additionalInfo.hashCode(); return result; }