System.out.println("testing");
public class Main { int x = 5; public static void main(String[] args) { Main myObj = new Main(); System.out.println(myObj.x); } }
import java.util.zip.GZIPOutputStream; import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStreamReader; import java.util.zip.GZIPInputStream; //String str = "now is the time for all good men to come to aid of their country"; String str = sampler.getArguments().getArgument(0).getValue(); System.out.println("String length : " + str.length()); ByteArrayOutputStream obj = new ByteArrayOutputStream(); GZIPOutputStream gzip = new GZIPOutputStream(obj); gzip.write(str.getBytes("UTF-8")); gzip.close(); sampler.getArguments().getArgument(0).setValue(obj.toString()); log.info("-------------------- after decompress ----------------------"); GZIPInputStream gis = new GZIPInputStream(new ByteArrayInputStream(obj.toByteArray())); BufferedReader bf = new BufferedReader(new InputStreamReader(gis, "UTF-8")); String outStr = ""; String line; while ((line=bf.readLine())!=null) { outStr += line; } log.info("Output String lenght : " + outStr.length()); log.info(outStr);