use of com.peterphi.carbon.exception.CarbonException in project stdlib by petergeneric.
the class CarbonClientImpl method serialise.
private static byte[] serialise(Element element) {
try {
final ByteArrayOutputStream bos = new ByteArrayOutputStream(1024);
new XMLOutputter().output(element, bos);
return bos.toByteArray();
} catch (IOException e) {
throw new CarbonException(e.getMessage(), e);
}
}
use of com.peterphi.carbon.exception.CarbonException in project stdlib by petergeneric.
the class CarbonClientImpl method send.
private String send(byte[] data) throws CarbonException {
try {
log.trace("Connecting to Carbon...");
final Socket socket = createSocket();
final CarbonSocketAPI api = new CarbonSocketAPI(socket);
return api.send(data);
} catch (CarbonException e) {
throw e;
} catch (Exception e) {
throw new CarbonException(e);
}
}
Aggregations