/** * {@inheritDoc} */ public Logo createProperty(final List<Parameter> params, final String value) throws URISyntaxException, DecoderException { return new Logo(params, value); }
/** * {@inheritDoc} */ @Override public void validate() throws ValidationException { for (Parameter param : getParameters()) { assertPidParameter(param); } }
/** * @param binary a byte array of logo data * @param contentType the MIME type of the logo data */ public Logo(byte[] binary, Type contentType) { super(Id.LOGO); this.binary = binary; getParameters().add(Encoding.B); if (contentType != null) { getParameters().add(contentType); } }
/** * {@inheritDoc} */ @Override public String getValue() { String stringValue = null; if (Value.URI.equals(getParameter(Parameter.Id.VALUE))) { stringValue = Strings.valueOf(uri); } else if (binary != null) { try { final BinaryEncoder encoder = new Base64(); stringValue = new String(encoder.encode(binary)); } catch (EncoderException ee) { log.error("Error encoding binary data", ee); } } return stringValue; }
private void createLogo(URI uri, URI prop, Logo logo) throws RDFHandlerException, RDFParseException { if(logo.getUri() != null) { URI r_logo = createURI(logo.getUri().toString()); rdfHandler.handleStatement(createStatement(uri,prop,r_logo)); } else { log.warn("ignoring logo relation, since binary logos are not supported in RDF"); } }
/** * @param binary a byte array of logo data * @param contentType the MIME type of the logo data */ public Logo(byte[] binary, Type contentType) { super(Id.LOGO); this.binary = binary; getParameters().add(Encoding.B); if (contentType != null) { getParameters().add(contentType); } }
/** * {@inheritDoc} */ @Override public String getValue() { String stringValue = null; if (Value.URI.equals(getParameter(Parameter.Id.VALUE))) { stringValue = Strings.valueOf(uri); } else if (binary != null) { try { final BinaryEncoder encoder = new Base64(); stringValue = new String(encoder.encode(binary)); } catch (EncoderException ee) { log.error("Error encoding binary data", ee); } } return stringValue; }
private void createLogo(URI uri, URI prop, Logo logo) throws RDFHandlerException, RDFParseException { if(logo.getUri() != null) { URI r_logo = createURI(logo.getUri().toString()); rdfHandler.handleStatement(createStatement(uri,prop,r_logo)); } else { log.warn("ignoring logo relation, since binary logos are not supported in RDF"); } }
/** * {@inheritDoc} */ @Override public void validate() throws ValidationException { for (Parameter param : getParameters()) { assertPidParameter(param); } }
/** * @param uri a URI that specifies the location of a logo */ public Logo(URI uri) { super(Id.LOGO); this.uri = uri; getParameters().add(Value.URI); }
/** * Factory constructor. * * @param params property parameters * @param value string representation of a property value * @throws URISyntaxException where the specified URI value is an invalid URI * @throws DecoderException where the specified logo data value cannot be decoded */ public Logo(List<Parameter> params, String value) throws URISyntaxException, DecoderException { super(Id.LOGO, params); final Parameter valueParameter = getParameter(Parameter.Id.VALUE); /* * in the relaxed parsing mode we allow the vcard 2.1-style VALUE=URL parameter */ if (Value.URI.equals(valueParameter) || valueParameter != null && CompatibilityHints.isHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING) && "URL".equalsIgnoreCase(valueParameter.getValue())) { this.uri = new URI(value); } else { final BinaryDecoder decoder = new Base64(); this.binary = decoder.decode(value.getBytes()); } }
/** * {@inheritDoc} */ public Logo createProperty(final List<Parameter> params, final String value) throws URISyntaxException, DecoderException { return new Logo(params, value); }
/** * @param uri a URI that specifies the location of a logo */ public Logo(URI uri) { super(Id.LOGO); this.uri = uri; getParameters().add(Value.URI); }
/** * Factory constructor. * @param params property parameters * @param value string representation of a property value * @throws URISyntaxException where the specified URI value is an invalid URI * @throws DecoderException where the specified logo data value cannot be decoded */ public Logo(List<Parameter> params, String value) throws URISyntaxException, DecoderException { super(Id.LOGO, params); final Parameter valueParameter = getParameter(Parameter.Id.VALUE); /* * in the relaxed parsing mode we allow the vcard 2.1-style VALUE=URL parameter */ if (valueParameter != null && Value.URI.equals(valueParameter) || valueParameter != null && CompatibilityHints.isHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING) && "URL".equalsIgnoreCase(valueParameter.getValue())) { this.uri = new URI(value); } else { final BinaryDecoder decoder = new Base64(); this.binary = decoder.decode(value.getBytes()); } }