/** * Combine multiple {@link Guid}s into a single {@link Guid}. * @throws IOException */ public static Guid combine(Guid... guids) throws IOException { byte[][] byteArrays = new byte[guids.length][]; for (int i = 0; i < guids.length; i++) { byteArrays[i] = guids[i].sha; } return fromByteArrays(byteArrays); }
/** * Creates a new {@link Guid} which is a unique, replicable representation of the pair (this, byteArrays). * @param byteArrays an array of byte arrays. * @return a new {@link Guid}. * @throws IOException */ public Guid append(byte[]... byteArrays) throws IOException { if (byteArrays == null || byteArrays.length == 0) { return this; } return fromByteArrays(ArrayUtils.add(byteArrays, this.sha)); }
/** * Generate a {@link Guid} for an array of {@link HasGuid}. * @param objs array of {@link HasGuid}. * @return a single {@link Guid} for the array. * @throws IOException */ public static Guid fromHasGuid(HasGuid... objs) throws IOException { byte[][] byteArrays = new byte[objs.length][]; for (int i = 0; i < objs.length; i++) { byteArrays[i] = objs[i].guid().sha; } return fromByteArrays(byteArrays); }