/** * {@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; }
/** * {@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; }
/** * 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()); } }
/** * 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()); } }