return baos.toByteArray();
}
private static Rule[] decodeRules(
final byte[] rulesBinary ) {
final SLDParser parser = new SLDParser(
CommonFactoryFinder.getStyleFactory(null),
new ByteArrayInputStream(
rulesBinary));
final StyledLayerDescriptor sld = parser.parseSLD();
final List<StyledLayer> layers = sld.layers();
if ((layers != null) && !layers.isEmpty()) {
// drill down to eventually get the rules from the sld
for (final StyledLayer l : layers) {
if (l instanceof NamedLayer) {