Ejemplo n.º 1
0
 /**
  * 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();
 }
Ejemplo n.º 2
0
 /**
  * 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();
 }