
ayze.jzlib.1.0.8.source-code.Converter Maven / Gradle / Ivy
/**
* Created by izeidman on 23/08/2016.
*/
package com.jcraft.jzlib;
import com.jcraft.jzlib.*;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
public class Converter {
public static String ToGzipAscii(String input)
{
int err;
int comprLen=40000;
int uncomprLen=comprLen;
byte[] compr=new byte[comprLen];
byte[] uncompr=new byte[uncomprLen];
ZStream c_stream=new ZStream();
byte[] inpuBytes = input.getBytes();
err=c_stream.deflateInit(JZlib.Z_DEFAULT_COMPRESSION);
CHECK_ERR(c_stream, err, "deflateInit");
c_stream.next_in=inpuBytes; //what to compress
c_stream.next_in_index=0;
c_stream.next_out=compr; //compressed data
c_stream.next_out_index=0;
while(c_stream.total_in!=inpuBytes.length && //there is more input to compress
c_stream.total_out
© 2015 - 2025 Weber Informatics LLC | Privacy Policy