use of htsjdk.samtools.util.RuntimeIOException in project jvarkit by lindenb.
the class IOUtils method gzipString.
/**
* compressed a String with gzip
*/
public static byte[] gzipString(final String s) {
byte[] array = s.getBytes();
try {
final ByteArrayOutputStream obj = new ByteArrayOutputStream(array.length);
final GZIPOutputStream gzip = new GZIPOutputStream(obj);
gzip.write(array);
gzip.finish();
gzip.flush();
gzip.close();
obj.close();
return obj.toByteArray();
} catch (final IOException err) {
throw new RuntimeIOException(err);
}
}
Aggregations