public static BinaryString concat ( Iterable < BinaryString > inputs ) { // Compute the total length of the result. int totalLength = 0 ; for ( BinaryString input : inputs ) { if ( input != null ) { input . ensureMaterialized ( ) ; totalLength += input . getSizeInBytes ( ) ; } } // Allocate a new byte array, and copy the inputs one by one into it. final byte [ ] result = new byte [ totalLength ] ; int offset = 0 ; for ( BinaryString input : inputs ) { if ( input != null ) { int len = input . sizeInBytes ; SegmentsUtil . copyToBytes ( input . segments , input . offset , result , offset , len ) ; offset += len ; } } return fromBytes ( result ) ; }
Concatenates input strings together into a single string .