Example usage for org.apache.commons.lang ArrayUtils addAll

List of usage examples for org.apache.commons.lang ArrayUtils addAll

Introduction

In this page you can find the example usage for org.apache.commons.lang ArrayUtils addAll.

Prototype

public static double[] addAll(double[] array1, double[] array2) 

Source Link

Document

Adds all the elements of the given arrays into a new array.

Usage

From source file:de.berlin.magun.nfcmime.core.NdefMessageBuilder.java

/**
 * Stores an NDEF record containing a URI, using the URI format definition.
 * @param uri the URI to be written//from  w ww. j  a  va 2  s.  c o  m
 * @throws IOException
 */
public void addUriRecord(String uri) throws IOException {
    if (!this.hasChecksum) {
        recordlist.add(new NdefRecord(NdefRecord.TNF_WELL_KNOWN, NdefRecord.RTD_URI, new byte[0],
                ArrayUtils.addAll(new byte[] { (byte) 0x00 }, uri.getBytes(Charset.forName("UTF-8")))));
    } else {
        throw new IOException("Cannot add record - last record is a checksum.");
    }
}

From source file:com.splicemachine.derby.impl.sql.execute.operations.StressSparkIT.java

@Parameterized.Parameters(name = "{index}: maxLevel {1} loops {2} {0}")
public static Collection<Object[]> data() {
    List<Object[]> primaryKey = Arrays.asList(new Object[] { "" }, new Object[] { "primary key" });
    List<Object[]> loops = Arrays.asList(new Object[] { 22, 1 }, new Object[] { 10, 5 });
    List<Object[]> permutations = new ArrayList<>();
    for (Object[] pk : primaryKey) {
        for (Object[] l : loops) {
            permutations.add(ArrayUtils.addAll(pk, l));
        }//from w  w w.j  a v a  2  s  .co  m
    }
    return permutations;
}

From source file:com.tutu.flume.ExtendableSinkCounter.java

public ExtendableSinkCounter(String name, String... args) {
    super(MonitoredCounterGroup.Type.SINK, name, (String[]) ArrayUtils.addAll(ATTRIBUTES, args));
}

From source file:com.laex.cg2d.model.joints.BEFrictionJoint.java

@Override
public IPropertyDescriptor[] getPropertyDescriptors() {
    return (IPropertyDescriptor[]) ArrayUtils.addAll(super.getPropertyDescriptors(), descriptors);
}

From source file:com.asual.summer.core.resource.MessageResource.java

public void setWildcardLocations(String[] locations) {

    super.setLocations(locations);

    PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
    List<Resource[]> resourceLocations = new ArrayList<Resource[]>();

    List<String> fileBasenames = new ArrayList<String>();
    List<String> jarBasenames = new ArrayList<String>();

    for (String location : locations) {
        try {//w  w  w . j  av a2 s.c  o m
            Resource[] wildcard = (Resource[]) ArrayUtils.addAll(
                    resolver.getResources(location + "*.properties"),
                    resolver.getResources(location + "*.xml"));
            if (wildcard != null && wildcard.length > 0) {
                resourceLocations.add(wildcard);
            }
        } catch (IOException e) {
            logger.error(e.getMessage(), e);
        }
    }

    int i = 0;
    boolean entries = true;

    while (entries) {
        entries = false;
        for (Resource[] location : resourceLocations) {
            if (location.length > i) {
                try {
                    URL url = location[i].getURL();
                    boolean isJar = ResourceUtils.isJarURL(url);
                    String basename = "classpath:" + url.getFile()
                            .replaceFirst(isJar ? "^.*" + ResourceUtils.JAR_URL_SEPARATOR
                                    : "^(.*/test-classes|.*/classes|.*/resources)/", "")
                            .replaceAll("(_\\w+){0,3}\\.(properties|xml)", "");
                    if (isJar) {
                        if (!jarBasenames.contains(basename)) {
                            jarBasenames.add(basename);
                        }
                    } else {
                        if (!fileBasenames.contains(basename)) {
                            fileBasenames.add(basename);
                        }
                    }
                } catch (IOException e) {
                    logger.error(e.getMessage(), e);
                }
                entries = true;
            }
        }
        i++;
    }

    fileBasenames.addAll(jarBasenames);

    rbms.clearCache();
    rbms.setBasenames(fileBasenames.toArray(new String[fileBasenames.size()]));
}

From source file:mitm.common.util.MiscArrayUtils.java

/**
 * Encodes the byte array to a String consisting of all readable characters.
 *//*ww w . j  ava2  s . c  om*/
public static String toMaxRadix(byte[] bytes) {
    Check.notNull(bytes, "bytes");

    /*
     * We need to make sure that the BigInteger will be positive and that any starting zero (0) bytes
     * are not removed.
     */
    byte[] pos = ArrayUtils.addAll(new byte[] { 1 }, bytes);

    BigInteger bigInt = new BigInteger(pos);

    return bigInt.toString(Character.MAX_RADIX);
}

From source file:net.michaelpigg.xbeelib.protocol.XbeeAddress.java

/** Returns complete address byte array as used in XBee remote commands */
public byte[] getCombinedAddress() {
    return ArrayUtils.addAll(address_64, address_16);
}

From source file:com.bstek.dorado.view.loader.PackagesConfigPackageParser.java

@Override
@SuppressWarnings("unchecked")
protected Object doParse(Node node, ParseContext context) throws Exception {
    Element element = (Element) node;
    String name = element.getAttribute("name");
    Assert.notEmpty(name);// ww  w  .j  a  v a 2 s .  co  m

    Package pkg;
    PackagesConfig packagesConfig = ((PackagesConfigParseContext) context).getPackagesConfig();
    Map<String, Package> packages = packagesConfig.getPackages();
    pkg = packages.get(name);
    if (pkg == null) {
        pkg = new Package(name);
        packages.put(name, pkg);
    }

    Map<String, Object> properties = parseProperties(element, context);
    if (!properties.containsKey("fileNames")) {
        Object value = parseProperty("fileNames", element, context);
        if (value != null && value != ConfigUtils.IGNORE_VALUE) {
            properties.put("fileNames", value);
        }
    }

    String fileNamesText = StringUtils.trim((String) properties.remove("fileNames"));
    fileNamesText = StringUtils.defaultIfEmpty(fileNamesText, NONE_FILE);
    String[] oldFileNames = pkg.getFileNames();
    String[] newFileNames = fileNamesText.split(",");
    if (oldFileNames != null && oldFileNames.length > 0) {
        newFileNames = (String[]) ArrayUtils.addAll(oldFileNames, newFileNames);
    }
    pkg.setFileNames(newFileNames);

    String dependsText = (String) properties.remove("depends");
    if (StringUtils.isNotEmpty(dependsText)) {
        String[] dependsArray = dependsText.split(",");
        for (String depends : dependsArray) {
            pkg.getDepends().add(depends);
        }
    }

    String dependedByText = (String) properties.remove("dependedBy");
    if (StringUtils.isNotEmpty(dependedByText)) {
        String[] dependedByArray = dependedByText.split(",");
        for (String dependedBy : dependedByArray) {
            pkg.getDependedBy().add(dependedBy);
        }
    }

    String clientTypeText = (String) properties.remove("clientType");
    if (StringUtils.isNotEmpty(clientTypeText)) {
        pkg.setClientType(ClientType.parseClientTypes(clientTypeText));
    }

    ((Map<String, Object>) new BeanMap(pkg)).putAll(properties);
    return pkg;
}

From source file:com.bah.culvert.util.Bytes.java

/**
 * Sum the elements of the two arrays into new array
 * @param array1//from ww  w . j ava 2  s . com
 * @param array2
 * @return
 */
public static byte[] add(byte[] array1, byte[] array2) {
    return ArrayUtils.addAll(array1, array2);

}

From source file:eu.dime.ps.semantic.query.impl.AbstractQuery.java

@Override
public Query<T> select(URI... properties) {
    this.selectedProperties = (URI[]) ArrayUtils.addAll(this.selectedProperties, properties);
    return this;
}