Пример #1
0
  public static boolean areEqual(SVNPropertyValue propertyValue1, SVNPropertyValue propertyValue2) {
    if (propertyValue1 == null) {
      return propertyValue2 == null;
    }
    if (propertyValue2 == null) {
      return false;
    }
    byte[] propertyValueBytes1 = SVNPropertyValue.getPropertyAsBytes(propertyValue1);
    byte[] propertyValueBytes2 = SVNPropertyValue.getPropertyAsBytes(propertyValue2);

    return Arrays.equals(propertyValueBytes1, propertyValueBytes2);
  }
Пример #2
0
  public static void appendProperty(String name, SVNPropertyValue value, OutputStream target)
      throws SVNException {
    if (name == null || value == null) {
      return;
    }

    byte[] bytes = SVNPropertyValue.getPropertyAsBytes(value);

    try {
      writeProperty(target, 'K', name.getBytes("UTF-8"));
      writeProperty(target, 'V', bytes);
    } catch (IOException ioe) {
      SVNErrorMessage err =
          SVNErrorMessage.create(SVNErrorCode.IO_ERROR, ioe.getLocalizedMessage());
      SVNErrorManager.error(err, ioe, SVNLogType.WC);
    }
  }
Пример #3
0
 public static void setProperties(
     SVNProperties namesToValues, OutputStream target, String terminator) throws SVNException {
   try {
     Object[] keys = namesToValues.nameSet().toArray();
     Arrays.sort(keys);
     for (int i = 0; i < keys.length; i++) {
       String propertyName = (String) keys[i];
       writeProperty(target, 'K', propertyName.getBytes("UTF-8"));
       writeProperty(
           target,
           'V',
           SVNPropertyValue.getPropertyAsBytes(namesToValues.getSVNPropertyValue(propertyName)));
     }
     if (terminator != null) {
       target.write(terminator.getBytes("UTF-8"));
       target.write('\n');
     }
   } catch (IOException ioe) {
     SVNErrorMessage err =
         SVNErrorMessage.create(SVNErrorCode.IO_ERROR, ioe.getLocalizedMessage());
     SVNErrorManager.error(err, ioe, SVNLogType.WC);
   }
 }
Пример #4
0
 public void setPropertyValue(String name, SVNPropertyValue value) throws SVNException {
   byte[] bytes = SVNPropertyValue.getPropertyAsBytes(value);
   int length = bytes != null && bytes.length >= 0 ? bytes.length : -1;
   setPropertyValue(name, bytes != null ? new ByteArrayInputStream(bytes) : null, length);
 }