Search in sources :

Example 21 with RuntimeIOException

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);
    }
}
Also used : RuntimeIOException(htsjdk.samtools.util.RuntimeIOException) GZIPOutputStream(java.util.zip.GZIPOutputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) RuntimeIOException(htsjdk.samtools.util.RuntimeIOException) IOException(java.io.IOException)

Aggregations

RuntimeIOException (htsjdk.samtools.util.RuntimeIOException)21 IOException (java.io.IOException)11 File (java.io.File)6 List (java.util.List)5 VariantContext (htsjdk.variant.variantcontext.VariantContext)4 JvarkitException (com.github.lindenb.jvarkit.lang.JvarkitException)3 SAMSequenceDictionary (htsjdk.samtools.SAMSequenceDictionary)3 VariantContextBuilder (htsjdk.variant.variantcontext.VariantContextBuilder)3 VCFHeader (htsjdk.variant.vcf.VCFHeader)3 VCFInfoHeaderLine (htsjdk.variant.vcf.VCFInfoHeaderLine)3 InputStream (java.io.InputStream)3 ArrayList (java.util.ArrayList)3 Parameter (com.beust.jcommander.Parameter)2 TeeInputStream (com.github.lindenb.jvarkit.io.TeeInputStream)2 Launcher (com.github.lindenb.jvarkit.util.jcommander.Launcher)2 Program (com.github.lindenb.jvarkit.util.jcommander.Program)2 Logger (com.github.lindenb.jvarkit.util.log.Logger)2 SAMSequenceDictionaryProgress (com.github.lindenb.jvarkit.util.picard.SAMSequenceDictionaryProgress)2 VCFUtils (com.github.lindenb.jvarkit.util.vcf.VCFUtils)2 VcfIterator (com.github.lindenb.jvarkit.util.vcf.VcfIterator)2