(Object... parts)
| 158 | // ---------------------------- |
| 159 | |
| 160 | public static Object binaryConcat(Object... parts) { |
| 161 | ArrayList<Byte> out = new ArrayList<>(); |
| 162 | for (Object part : parts) { |
| 163 | if (part instanceof String s) { |
| 164 | byte[] bytes = s.getBytes(StandardCharsets.US_ASCII); |
| 165 | for (byte b : bytes) out.add(b); |
| 166 | } else if (part instanceof byte[] arr) { |
| 167 | for (byte b : arr) out.add(b); |
| 168 | } else { |
| 169 | throw new IllegalArgumentException("BinaryConcat: Unsupported type, only String and byte[] are allowed."); |
| 170 | } |
| 171 | } |
| 172 | byte[] res = new byte[out.size()]; |
| 173 | for (int i = 0; i < out.size(); i++) res[i] = out.get(i); |
| 174 | return res; |
| 175 | } |
| 176 | |
| 177 | public static Object binaryConcatArray(Object arrays2) { |
| 178 | List<Object> arrays = (List<Object>) arrays2; |
no test coverage detected