Java Code Examples for org.fourthline.cling.model.types.UDN#PREFIX

The following examples show how to use org.fourthline.cling.model.types.UDN#PREFIX . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: USNRootDeviceHeader.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
public void setString(String s) throws InvalidHeaderException {
    if (!s.startsWith(UDN.PREFIX) || !s.endsWith(ROOT_DEVICE_SUFFIX)) {
        throw new InvalidHeaderException(
                "Invalid root device USN header value, must start with '" +
                        UDN.PREFIX + "' and end with '" +
                        ROOT_DEVICE_SUFFIX + "' but is '" + s + "'"
        );
    }
    UDN udn = new UDN(s.substring(UDN.PREFIX.length(), s.length() - ROOT_DEVICE_SUFFIX.length()));
    setValue(udn);
}
 
Example 2
Source File: UDNHeader.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
public void setString(String s) throws InvalidHeaderException {
    if (!s.startsWith(UDN.PREFIX)) {
        throw new InvalidHeaderException("Invalid UDA header value, must start with '"+UDN.PREFIX+"': " + s);
    }

    if (s.contains("::urn")) {
        throw new InvalidHeaderException("Invalid UDA header value, must not contain '::urn': " + s);
    }

    UDN udn = new UDN( s.substring(UDN.PREFIX.length()) );
    setValue(udn);
}
 
Example 3
Source File: USNRootDeviceHeader.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
public void setString(String s) throws InvalidHeaderException {
    if (!s.startsWith(UDN.PREFIX) || !s.endsWith(ROOT_DEVICE_SUFFIX)) {
        throw new InvalidHeaderException(
                "Invalid root device USN header value, must start with '" +
                        UDN.PREFIX + "' and end with '" +
                        ROOT_DEVICE_SUFFIX + "' but is '" + s + "'"
        );
    }
    UDN udn = new UDN(s.substring(UDN.PREFIX.length(), s.length() - ROOT_DEVICE_SUFFIX.length()));
    setValue(udn);
}
 
Example 4
Source File: UDNHeader.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
public void setString(String s) throws InvalidHeaderException {
    if (!s.startsWith(UDN.PREFIX)) {
        throw new InvalidHeaderException("Invalid UDA header value, must start with '"+UDN.PREFIX+"': " + s);
    }

    if (s.contains("::urn")) {
        throw new InvalidHeaderException("Invalid UDA header value, must not contain '::urn': " + s);
    }

    UDN udn = new UDN( s.substring(UDN.PREFIX.length()) );
    setValue(udn);
}