1 package size; 2 40 41 import java.io.*; 42 import javax.xml.parsers.*; 43 import java.util.Properties ; 44 import java.util.zip.*; 45 46 import com.sun.japex.*; 47 48 public class GzipXMLSizeDriver extends XMLSizeDriver { 49 50 public void finish(TestCase testCase) { 51 try { 52 ByteArrayOutputStream gzipBaos = new ByteArrayOutputStream(); 53 GZIPOutputStream gzipOs = new GZIPOutputStream(gzipBaos); 54 gzipOs.write(_xmlFileByteArray, 0, _xmlFileByteArray.length); 55 gzipOs.finish(); 56 57 testCase.setDoubleParam(Constants.RESULT_VALUE, 58 gzipBaos.toByteArray().length / 1024.0); 59 } 60 catch (IOException e) { 61 throw new RuntimeException (e); 62 } 63 } 64 } 65 | Popular Tags |