/** * Returns a string representation of this object. * * <p/> * Note: irrelevant for binary properties. * * @return string representation of this object */ public String toString() { if (isBinary()) { return "property is binary"; } return getString(); }
/** * Returns a string representation of this object. * * <p/> * Note: irrelevant for binary properties. * * @return string representation of this object */ public String toString() { if (isBinary()) { return "property is binary"; } return getString(); }
/** * Returns a string representation of this object. * * <p/> * Note: irrelevant for binary properties. * * @return string representation of this object */ public String toString() { if (isBinary()) { return "property is binary"; } return getString(); }
/** * Returns <code>String</code> representation of <code>value</code>. * * <p/> * If <code>value</code> is a {@link SVNPropertyValue#isBinary() binary} property value, then its bytes are * converted to a <code>String</code> encoding them with the <span class="javastring">"UTF-8"</span> charset * and returned back to the caller. If that encoding fails, bytes are encoded with the default platform's * charset. * * <p/> * Otherwise, {@link SVNPropertyValue#getString()} is returned. * * @param value property value object * @return string property value; <span class="javakeyword">null</span> if <code>value</code> is * <span class="javakeyword">null</span> */ public static String getPropertyAsString(SVNPropertyValue value) { if (value == null) { return null; } if (value.isBinary()) { try { return new String(value.getBytes(), "UTF-8"); } catch (UnsupportedEncodingException e) { return new String(value.getBytes()); } } return value.getString(); }
/** * Says whether this object and <code>obj</code> are equal or not. * * @param obj object to compare with * @return <span class="javakeyword">true</span> in the following cases: * <ul> * <li/><code>obj</code> is the same as this one (by reference) * <li/>if <code>obj</code> is an <code>SVNPropertyValue</code> and either has got the same * <code>String</code> value in case this object holds a <code>String</code> value, or * the same byte array contents if this object represents a binary property value * </ul> */ public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (obj instanceof SVNPropertyValue) { SVNPropertyValue value = (SVNPropertyValue) obj; if (isString()) { return myValue.equals(getPropertyAsString(value)); } else if (isBinary()) { return Arrays.equals(myData, getPropertyAsBytes(value)); } } return false; }
/** * Returns <code>String</code> representation of <code>value</code>. * * <p/> * If <code>value</code> is a {@link SVNPropertyValue#isBinary() binary} property value, then its bytes are * converted to a <code>String</code> encoding them with the <span class="javastring">"UTF-8"</span> charset * and returned back to the caller. If that encoding fails, bytes are encoded with the default platform's * charset. * * <p/> * Otherwise, {@link SVNPropertyValue#getString()} is returned. * * @param value property value object * @return string property value; <span class="javakeyword">null</span> if <code>value</code> is * <span class="javakeyword">null</span> */ public static String getPropertyAsString(SVNPropertyValue value) { if (value == null) { return null; } if (value.isBinary()) { try { return new String(value.getBytes(), "UTF-8"); } catch (UnsupportedEncodingException e) { return new String(value.getBytes()); } } return value.getString(); }
/** * Says whether this object and <code>obj</code> are equal or not. * * @param obj object to compare with * @return <span class="javakeyword">true</span> in the following cases: * <ul> * <li/><code>obj</code> is the same as this one (by reference) * <li/>if <code>obj</code> is an <code>SVNPropertyValue</code> and either has got the same * <code>String</code> value in case this object holds a <code>String</code> value, or * the same byte array contents if this object represents a binary property value * </ul> */ public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (obj instanceof SVNPropertyValue) { SVNPropertyValue value = (SVNPropertyValue) obj; if (isString()) { return myValue.equals(value.getString()); } else if (isBinary()) { return Arrays.equals(myData, getPropertyAsBytes(value)); } } return false; }
/** * Says whether this object and <code>obj</code> are equal or not. * * @param obj object to compare with * @return <span class="javakeyword">true</span> in the following cases: * <ul> * <li/><code>obj</code> is the same as this one (by reference) * <li/>if <code>obj</code> is an <code>SVNPropertyValue</code> and either has got the same * <code>String</code> value in case this object holds a <code>String</code> value, or * the same byte array contents if this object represents a binary property value * </ul> */ public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (obj instanceof SVNPropertyValue) { SVNPropertyValue value = (SVNPropertyValue) obj; if (isString()) { return myValue.equals(value.getString()); } else if (isBinary()) { return Arrays.equals(myData, getPropertyAsBytes(value)); } } return false; }
/** * Returns <code>String</code> representation of <code>value</code>. * * <p/> * If <code>value</code> is a {@link SVNPropertyValue#isBinary() binary} property value, then its bytes are * converted to a <code>String</code> encoding them with the <span class="javastring">"UTF-8"</span> charset * and returned back to the caller. If that encoding fails, bytes are encoded with the default platform's * charset. * * <p/> * Otherwise, {@link SVNPropertyValue#getString()} is returned. * * @param value property value object * @return string property value; <span class="javakeyword">null</span> if <code>value</code> is * <span class="javakeyword">null</span> */ public static char[] getPropertyAsChars(SVNPropertyValue value) { if (value == null) { return null; } if (value.isBinary()) { return SVNEncodingUtil.getChars(value.getBytes(), "UTF-8"); } return value.getString().toCharArray(); }
/** * Returns <code>String</code> representation of <code>value</code>. * * <p/> * If <code>value</code> is a {@link SVNPropertyValue#isBinary() binary} property value, then its bytes are * converted to a <code>String</code> encoding them with the <span class="javastring">"UTF-8"</span> charset * and returned back to the caller. If that encoding fails, bytes are encoded with the default platform's * charset. * * <p/> * Otherwise, {@link SVNPropertyValue#getString()} is returned. * * @param value property value object * @return string property value; <span class="javakeyword">null</span> if <code>value</code> is * <span class="javakeyword">null</span> */ public static String getPropertyAsString(SVNPropertyValue value) { if (value == null) { return null; } if (value.isBinary()) { try { return new String(value.getBytes(), "UTF-8"); } catch (UnsupportedEncodingException e) { return new String(value.getBytes()); } } return value.getString(); }
String stringValue = value.getString(); boolean isXMLSafe = true; if (value.isBinary()) { CharsetDecoder decoder = Charset.forName("UTF-8").newDecoder(); decoder.onMalformedInput(CodingErrorAction.REPORT);
String stringValue = value.getString(); boolean isXMLSafe = true; if (value.isBinary()) { CharsetDecoder decoder = Charset.forName("UTF-8").newDecoder(); decoder.onMalformedInput(CodingErrorAction.REPORT);
String stringValue = value.getString(); boolean isXMLSafe = true; if (value.isBinary()) { CharsetDecoder decoder = Charset.forName("UTF-8").newDecoder(); decoder.onMalformedInput(CodingErrorAction.REPORT);
if (property.getValue() != null && property.getValue().isBinary()) { CharsetDecoder decoder = Charset.forName("UTF-8").newDecoder(); decoder.onMalformedInput(CodingErrorAction.REPORT);
if (property.getValue() != null && property.getValue().isBinary()) { CharsetDecoder decoder = Charset.forName("UTF-8").newDecoder(); decoder.onMalformedInput(CodingErrorAction.REPORT);
if (propertyValue.isBinary()){ CharsetDecoder decoder = Charset.forName("UTF-8").newDecoder(); decoder.onMalformedInput(CodingErrorAction.REPORT);