org.apache.commons.lang3.ArrayUtils#toString ( )源码实例Demo

下面列出了org.apache.commons.lang3.ArrayUtils#toString ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

public static boolean isValid(String xml) {
   try {
      Map<String, Object> options = new HashMap();
      SignatureVerificationResult signatureResult = SignatureBuilderFactory.getSignatureBuilder(AdvancedElectronicSignatureEnumeration.XAdES).verify(xml.getBytes("UTF-8"), options);
      if (!signatureResult.isValid()) {
         throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_SIGNATURE_VALIDATION, new Object[]{ArrayUtils.toString(signatureResult.getErrors().toArray())});
      }

      X509Certificate cert = signatureResult.getSigningCert();
      if (cert.getExtendedKeyUsage().contains("0.4.0.2231.3.0")) {
         LOG.debug("ExtendedKeyUsage correct. OID 0.4.0.2231.3.0 found.");
         dumpTsloStore();
         return match(baseOnCert(cert)) || match(basedOnPublicKey(cert));
      }
   } catch (Exception var4) {
      LOG.error("Unable to verify signature Reason:" + var4.getMessage(), var4);
   }

   return false;
}
 
public static boolean isValid(String xml) {
   try {
      Map<String, Object> options = new HashMap();
      SignatureVerificationResult signatureResult = SignatureBuilderFactory.getSignatureBuilder(AdvancedElectronicSignatureEnumeration.XAdES).verify(xml.getBytes("UTF-8"), options);
      if (!signatureResult.isValid()) {
         throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_SIGNATURE_VALIDATION, new Object[]{ArrayUtils.toString(signatureResult.getErrors().toArray())});
      }

      X509Certificate cert = signatureResult.getSigningCert();
      if (cert.getExtendedKeyUsage().contains("0.4.0.2231.3.0")) {
         LOG.debug("ExtendedKeyUsage correct. OID 0.4.0.2231.3.0 found.");
         dumpTsloStore();
         return match(baseOnCert(cert)) || match(basedOnPublicKey(cert));
      }
   } catch (Exception var4) {
      LOG.error("Unable to verify signature Reason:" + var4.getMessage(), var4);
   }

   return false;
}
 
public static boolean isValid(String xml) {
   try {
      Map<String, Object> options = new HashMap();
      SignatureVerificationResult signatureResult = SignatureBuilderFactory.getSignatureBuilder(AdvancedElectronicSignatureEnumeration.XAdES).verify(xml.getBytes("UTF-8"), options);
      if (!signatureResult.isValid()) {
         throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_SIGNATURE_VALIDATION, new Object[]{ArrayUtils.toString(signatureResult.getErrors().toArray())});
      }

      X509Certificate cert = signatureResult.getSigningCert();
      if (cert.getExtendedKeyUsage().contains("0.4.0.2231.3.0")) {
         LOG.debug("ExtendedKeyUsage correct. OID 0.4.0.2231.3.0 found.");
         dumpTsloStore();
         return match(baseOnCert(cert)) || match(basedOnPublicKey(cert));
      }
   } catch (Exception var4) {
      LOG.error("Unable to verify signature Reason:" + var4.getMessage(), var4);
   }

   return false;
}
 
源代码4 项目: deeplearning4j   文件: NumpyArray.java
private void setND4JArray() {

        long size = 1;
        for (long d : shape) {
            size *= d;
        }

        String cacheKey = address + "_" + size + "_" + dtype + "_" + ArrayUtils.toString(strides);
        nd4jArray = arrayCache.get(cacheKey);
        if (nd4jArray == null) {
            Pointer ptr = nativeOps.pointerForAddress(address);
            ptr = ptr.limit(size);
            ptr = ptr.capacity(size);
            DataBuffer buff = Nd4j.createBuffer(ptr, size, dtype);

            int elemSize = buff.getElementSize();
            long[] nd4jStrides = new long[strides.length];
            for (int i = 0; i < strides.length; i++) {
                nd4jStrides[i] = strides[i] / elemSize;
            }

            nd4jArray = Nd4j.create(buff, shape, nd4jStrides, 0, Shape.getOrder(shape, nd4jStrides, 1), dtype);
            arrayCache.put(cacheKey, nd4jArray);
        }
        else{
            if (!Arrays.equals(nd4jArray.shape(), shape)){
                nd4jArray = nd4jArray.reshape(shape);
            }
        }
        Nd4j.getAffinityManager().ensureLocation(nd4jArray, AffinityManager.Location.HOST);
    }
 
public static boolean isValid(String xml) throws TechnicalConnectorException {
   try {
      Map<String, Object> options = new HashMap();
      SignatureVerificationResult signatureResult = SignatureBuilderFactory.getSignatureBuilder(AdvancedElectronicSignatureEnumeration.XAdES).verify(xml.getBytes(), options);
      if (!signatureResult.isValid()) {
         throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_SIGNATURE_VALIDATION, new Object[]{ArrayUtils.toString(signatureResult.getErrors().toArray())});
      } else {
         return true;
      }
   } catch (Exception var3) {
      LOG.error("Unable to verify signature Reason:" + var3.getMessage(), var3);
      return false;
   }
}
 
源代码6 项目: pacaya   文件: TensorTest.java
private void auxTestMatlabIndex(int configIx, int[] dims, int... expected) {
    ArrayUtils.toString(expected);
    int[] observed = Tensor.unravelIndexMatlab(configIx, dims);
    System.out.println(String.format("expected: %s\nobserved: %s", ArrayUtils.toString(expected), ArrayUtils.toString(observed)));
    org.junit.Assert.assertArrayEquals(expected, observed);
    org.junit.Assert.assertEquals(configIx, Tensor.ravelIndexMatlab(expected, dims));
}
 
public static boolean isValid(String xml) throws TechnicalConnectorException {
   try {
      Map<String, Object> options = new HashMap();
      SignatureVerificationResult signatureResult = SignatureBuilderFactory.getSignatureBuilder(AdvancedElectronicSignatureEnumeration.XAdES).verify(xml.getBytes(), options);
      if (!signatureResult.isValid()) {
         throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_SIGNATURE_VALIDATION, new Object[]{ArrayUtils.toString(signatureResult.getErrors().toArray())});
      } else {
         return true;
      }
   } catch (Exception var3) {
      LOG.error("Unable to verify signature Reason:" + var3.getMessage(), var3);
      return false;
   }
}
 
public static boolean isValid(String xml) throws TechnicalConnectorException {
   try {
      Map<String, Object> options = new HashMap();
      SignatureVerificationResult signatureResult = SignatureBuilderFactory.getSignatureBuilder(AdvancedElectronicSignatureEnumeration.XAdES).verify(xml.getBytes(), options);
      if (!signatureResult.isValid()) {
         throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_SIGNATURE_VALIDATION, new Object[]{ArrayUtils.toString(signatureResult.getErrors().toArray())});
      } else {
         return true;
      }
   } catch (Exception var3) {
      LOG.error("Unable to verify signature Reason:" + var3.getMessage(), var3);
      return false;
   }
}
 
public static boolean isValid(String xml) throws TechnicalConnectorException {
   try {
      Map<String, Object> options = new HashMap();
      SignatureVerificationResult signatureResult = SignatureBuilderFactory.getSignatureBuilder(AdvancedElectronicSignatureEnumeration.XAdES).verify(xml.getBytes(), options);
      if (!signatureResult.isValid()) {
         throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_SIGNATURE_VALIDATION, new Object[]{ArrayUtils.toString(signatureResult.getErrors().toArray())});
      } else {
         return true;
      }
   } catch (Exception var3) {
      LOG.error("Unable to verify signature Reason:" + var3.getMessage(), var3);
      return false;
   }
}
 
源代码10 项目: java-study   文件: LangTest.java
public static void test() {
	// 1 合并两个数组: org.apache.commons.lang. ArrayUtils
	String[] s1 = new String[] { "1", "2", "3" };
	String[] s2 = new String[] { "a", "b", "c" };
	String[] s = (String[]) ArrayUtils.addAll(s1, s2);
	for (int i = 0; i < s.length; i++) {
		System.out.println(s[i]);
	}
	String str = ArrayUtils.toString(s);
	str = str.substring(1, str.length() - 1);
	System.out.println(str + ">>" + str.length());

	System.out.println("测试截取:" + StringUtils.substringAfter("SELECT * FROM PERSON ", "FROM"));
	// 3 判断该字符串是不是为数字(0~9)组成,如果是,返回true 但该方法不识别有小数点和 请注意。
	System.out.println("数字判断:" + StringUtils.isNumeric("454534"));
	System.out.println("取得类名:" + ClassUtils.getShortClassName(LangTest.class));
	System.out.println("获取包名:" + ClassUtils.getPackageName(LangTest.class));

	System.out.println("是否是数字:" + NumberUtils.isCreatable("123"));
	System.out.println("随机数字和字母:" + RandomStringUtils.randomAlphanumeric(5));
	System.out.println("<>进行转义" + StringEscapeUtils.escapeHtml("<html>"));

	System.out.println("是否是null字符 :" + StringUtils.isBlank(null));
	System.out.println("是否是空字符 :" + StringUtils.isBlank(""));
	System.out.println("是否是空格字符 :" + StringUtils.isBlank("   "));
	System.out.println("分割数组:" + StringUtils.join(s1, ","));
	System.out.println("添加某个字符,使其长度等于所设置的:" + StringUtils.rightPad("abc", 6, 'T'));
	System.out.println("首字母大写:" + StringUtils.capitalize("abc"));
	System.out.println("去掉空格:" + StringUtils.deleteWhitespace("   ab  c  "));
	System.out.println("是否包含该字符:" + StringUtils.contains("abc", "ba"));
	System.out.println("表示左边的字符:" + StringUtils.left("abc", 2));
}
 
/**
 * Will change the default minority label from "1" to "0" and correspondingly the majority class from "0" to "1"
 * for the label at the index specified
 */
public void overrideMinorityDefault(int index) {
    if (targetMinorityDistMap.containsKey(index)) {
        minorityLabelMap.put(index, 0);
    } else {
        throw new IllegalArgumentException(
                        "Index specified is not contained in the target minority distribution map specified with the preprocessor. Map contains "
                                        + ArrayUtils.toString(targetMinorityDistMap.keySet().toArray()));
    }
}
 
源代码12 项目: cukes   文件: EntityFacade.java
private String toString(Object value) throws NamingException {
    try {
        if (value instanceof byte[]) {
            return new String((byte[]) value, "UTF-8");
        } else if (value instanceof char[]) {
            return new String((char[]) value);
        } else if (value.getClass().isArray()) {
            return ArrayUtils.toString(value);
        }
        return value.toString();
    } catch (UnsupportedEncodingException e) {
        throw new CucumberException("Failed to convert value to string", e);
    }
}
 
源代码13 项目: mithqtt   文件: MqttSubAckPayload.java
@Override
public String toString() {
    return StringUtil.simpleClassName(this)
            + '['
            + "grantedQoSLevels=" + ArrayUtils.toString(grantedQoSLevels)
            + ']';
}
 
源代码14 项目: mithqtt   文件: MqttSubscribePayload.java
@Override
public String toString() {
    return StringUtil.simpleClassName(this)
            + '['
            + "subscriptions=" + ArrayUtils.toString(subscriptions)
            + ']';
}
 
源代码15 项目: mithqtt   文件: MqttUnsubscribePayload.java
@Override
public String toString() {
    return StringUtil.simpleClassName(this)
            + '['
            + "topics=" + ArrayUtils.toString(topics)
            + ']';
}
 
@Override
protected void beforeRun(Outline outline, Options options) throws Exception {
	super.beforeRun(outline, options);
	final String[] configLocations = getConfigLocations();
	if (!ArrayUtils.isEmpty(configLocations)) {
		final String configLocationsString = ArrayUtils
				.toString(configLocations);
		logger.debug("Loading application context from ["
				+ configLocationsString + "].");
		try {
			applicationContext = new FileSystemXmlApplicationContext(
					configLocations, false);
			applicationContext.setClassLoader(Thread.currentThread()
					.getContextClassLoader());
			applicationContext.refresh();
			if (getAutowireMode() != AutowireCapableBeanFactory.AUTOWIRE_NO) {
				applicationContext.getBeanFactory().autowireBeanProperties(
						this, getAutowireMode(), isDependencyCheck());
			}
		} catch (Exception ex) {
			ex.printStackTrace();
			ex.getCause().printStackTrace();
			logger.error("Error loading applicaion context from ["
					+ configLocationsString + "].", ex);
			throw new BadCommandLineException(
					"Error loading  applicaion context from ["
							+ configLocationsString + "].", ex);
		}
	}
}
 
/**
 * Will change the default minority label from "1" to "0" and correspondingly the majority class from "0" to "1"
 * for the label at the index specified
 */
public void overrideMinorityDefault(int index) {
    if (targetMinorityDistMap.containsKey(index)) {
        minorityLabelMap.put(index, 0);
    } else {
        throw new IllegalArgumentException(
                        "Index specified is not contained in the target minority distribution map specified with the preprocessor. Map contains "
                                        + ArrayUtils.toString(targetMinorityDistMap.keySet().toArray()));
    }
}
 
源代码18 项目: tutorials   文件: ArrayOperations.java
public static String printIntArray(int[][] array) {
    return ArrayUtils.toString(array);
}
 
源代码19 项目: riiablo   文件: Server.java
@Override
public String toString() {
  return ArrayUtils.toString(clients);
}
 
源代码20 项目: tutorials   文件: ArrayOperations.java
public static String printObjectArray(Integer[] array) {
    return ArrayUtils.toString(array);
}