public static byte[] compress(final byte[] toCompress, Charset charset) {
ByteArrayOutputStream out = new ByteArrayOutputStream(toCompress.length);
final OutputStreamWriter writer = new OutputStreamWriter(out);
try {
new CssCompressor(new InputStreamReader(new ByteArrayInputStream(toCompress), charset)).compress(writer, 0);
writer.flush();
writer.close();
} catch (final Exception e) {
log.warn("Could not compress merged CSS stream, using uncompressed content", e);
return toCompress;