public static byte[] convertRequestToCbor(HystrixRequestEvents request) throws IOException { ByteArrayOutputStream cborString = new ByteArrayOutputStream(); CBORGenerator cbor = cborFactory.createGenerator(cborString); writeRequestAsCbor(cbor, request); cbor.flush(); cbor.close(); return cborString.toByteArray(); }
public static byte[] convertRequestsToCbor(Collection<HystrixRequestEvents> requests) throws IOException { ByteArrayOutputStream cborString = new ByteArrayOutputStream(); CBORGenerator cbor = cborFactory.createGenerator(cborString); cbor.writeStartArray(); for (HystrixRequestEvents request : requests) { writeRequestAsCbor(cbor, request); } cbor.writeEndArray(); cbor.close(); return cborString.toByteArray(); }