@Test public void testGetSystemValues() { ensureHasAllKeys(window.getSystemValues()); }
public Map<JreDeflateParameters, String> getSystemValues() { Map<JreDeflateParameters, String> result = new HashMap<JreDeflateParameters, String>(); MessageDigest digester; try { digester = MessageDigest.getInstance("SHA-256"); } catch (NoSuchAlgorithmException e) { throw new RuntimeException("System doesn't support SHA-256", e); } DeflateCompressor compressor = new DeflateCompressor(); compressor.setCaching(true); boolean[] nowrapValues = {true, false}; int[] strategies = {Deflater.DEFAULT_STRATEGY, Deflater.FILTERED, Deflater.HUFFMAN_ONLY}; int[] levels = {1, 2, 3, 4, 5, 6, 7, 8, 9}; for (final boolean nowrap : nowrapValues) { compressor.setNowrap(nowrap); for (final int strategy : strategies) { compressor.setStrategy(strategy); final int[] relevantLevels; if (strategy == Deflater.HUFFMAN_ONLY) { relevantLevels = new int[] {1}; } else { relevantLevels = levels; } for (final int level : relevantLevels) { compressor.setCompressionLevel(level); ByteArrayOutputStream buffer = new ByteArrayOutputStream(); try { compressor.compress(new ByteArrayInputStream(CorpusHolder.CORPUS_INSTANCE), buffer); } catch (IOException e) { throw new RuntimeException(e); } byte[] compressedData = buffer.toByteArray(); digester.reset(); byte[] sha256OfCompressedData = digester.digest(compressedData); String sha256String = hexString(sha256OfCompressedData); JreDeflateParameters parameters = JreDeflateParameters.of(level, strategy, nowrap); result.put(parameters, sha256String); } } } compressor.release(); return result; }
DefaultDeflateCompatibilityWindow { public Map<JreDeflateParameters, String> getSystemValues() { Map<JreDeflateParameters, String> result = new HashMap<JreDeflateParameters, String>(); MessageDigest digester; try { digester = MessageDigest.getInstance("SHA-256"); } catch (NoSuchAlgorithmException e) { throw new RuntimeException("System doesn't support SHA-256", e); } DeflateCompressor compressor = new DeflateCompressor(); compressor.setCaching(true); boolean[] nowrapValues = {true, false}; int[] strategies = {Deflater.DEFAULT_STRATEGY, Deflater.FILTERED, Deflater.HUFFMAN_ONLY}; int[] levels = {1, 2, 3, 4, 5, 6, 7, 8, 9}; for (final boolean nowrap : nowrapValues) { compressor.setNowrap(nowrap); for (final int strategy : strategies) { compressor.setStrategy(strategy); final int[] relevantLevels; if (strategy == Deflater.HUFFMAN_ONLY) { relevantLevels = new int[] {1}; } else { relevantLevels = levels; } for (final int level : relevantLevels) { compressor.setCompressionLevel(level); ByteArrayOutputStream buffer = new ByteArrayOutputStream(); try { compressor.compress(new ByteArrayInputStream(CorpusHolder.CORPUS_INSTANCE), buffer); } catch (IOException e) { throw new RuntimeException(e); } byte[] compressedData = buffer.toByteArray(); digester.reset(); byte[] sha256OfCompressedData = digester.digest(compressedData); String sha256String = hexString(sha256OfCompressedData); JreDeflateParameters parameters = JreDeflateParameters.of(level, strategy, nowrap); result.put(parameters, sha256String); } } } compressor.release(); return result; } }
DefaultDeflateCompatibilityWindow { public Map<JreDeflateParameters, String> getSystemValues() { Map<JreDeflateParameters, String> result = new HashMap<JreDeflateParameters, String>(); MessageDigest digester; try { digester = MessageDigest.getInstance("SHA-256"); } catch (NoSuchAlgorithmException e) { throw new RuntimeException("System doesn't support SHA-256", e); } DeflateCompressor compressor = new DeflateCompressor(); compressor.setCaching(true); boolean[] nowrapValues = {true, false}; int[] strategies = {Deflater.DEFAULT_STRATEGY, Deflater.FILTERED, Deflater.HUFFMAN_ONLY}; int[] levels = {1, 2, 3, 4, 5, 6, 7, 8, 9}; for (final boolean nowrap : nowrapValues) { compressor.setNowrap(nowrap); for (final int strategy : strategies) { compressor.setStrategy(strategy); final int[] relevantLevels; if (strategy == Deflater.HUFFMAN_ONLY) { relevantLevels = new int[] {1}; } else { relevantLevels = levels; } for (final int level : relevantLevels) { compressor.setCompressionLevel(level); ByteArrayOutputStream buffer = new ByteArrayOutputStream(); try { compressor.compress(new ByteArrayInputStream(CorpusHolder.CORPUS_INSTANCE), buffer); } catch (IOException e) { throw new RuntimeException(e); } byte[] compressedData = buffer.toByteArray(); digester.reset(); byte[] sha256OfCompressedData = digester.digest(compressedData); String sha256String = hexString(sha256OfCompressedData); JreDeflateParameters parameters = JreDeflateParameters.of(level, strategy, nowrap); result.put(parameters, sha256String); } } } compressor.release(); return result; }  }
DefaultDeflateCompatibilityWindow { public Map<JreDeflateParameters, String> getSystemValues() { Map<JreDeflateParameters, String> result = new HashMap<JreDeflateParameters, String>(); MessageDigest digester; try { digester = MessageDigest.getInstance("SHA-256"); } catch (NoSuchAlgorithmException e) { throw new RuntimeException("System doesn't support SHA-256", e); } DeflateCompressor compressor = new DeflateCompressor(); compressor.setCaching(true); boolean[] nowrapValues = {true, false}; int[] strategies = {Deflater.DEFAULT_STRATEGY, Deflater.FILTERED, Deflater.HUFFMAN_ONLY}; int[] levels = {1, 2, 3, 4, 5, 6, 7, 8, 9}; for (final boolean nowrap : nowrapValues) { compressor.setNowrap(nowrap); for (final int strategy : strategies) { compressor.setStrategy(strategy); final int[] relevantLevels; if (strategy == Deflater.HUFFMAN_ONLY) { relevantLevels = new int[] {1}; } else { relevantLevels = levels; } for (final int level : relevantLevels) { compressor.setCompressionLevel(level); ByteArrayOutputStream buffer = new ByteArrayOutputStream(); try { compressor.compress(new ByteArrayInputStream(CorpusHolder.CORPUS_INSTANCE), buffer); } catch (IOException e) { throw new RuntimeException(e); } byte[] compressedData = buffer.toByteArray(); digester.reset(); byte[] sha256OfCompressedData = digester.digest(compressedData); String sha256String = hexString(sha256OfCompressedData); JreDeflateParameters parameters = JreDeflateParameters.of(level, strategy, nowrap); result.put(parameters, sha256String); } } } compressor.release(); return result; }  Map<JreDeflateParameters, String> getBaselineValues(); byte[] getCorpus(); boolean isCompatible(); Map<JreDeflateParameters, String> getIncompatibleValues(); Map<JreDeflateParameters, String> getSystemValues(); }
DefaultDeflateCompatibilityWindow { public Map<JreDeflateParameters, String> getSystemValues() { Map<JreDeflateParameters, String> result = new HashMap<JreDeflateParameters, String>(); MessageDigest digester; try { digester = MessageDigest.getInstance("SHA-256"); } catch (NoSuchAlgorithmException e) { throw new RuntimeException("System doesn't support SHA-256", e); } DeflateCompressor compressor = new DeflateCompressor(); compressor.setCaching(true); boolean[] nowrapValues = {true, false}; int[] strategies = {Deflater.DEFAULT_STRATEGY, Deflater.FILTERED, Deflater.HUFFMAN_ONLY}; int[] levels = {1, 2, 3, 4, 5, 6, 7, 8, 9}; for (final boolean nowrap : nowrapValues) { compressor.setNowrap(nowrap); for (final int strategy : strategies) { compressor.setStrategy(strategy); final int[] relevantLevels; if (strategy == Deflater.HUFFMAN_ONLY) { relevantLevels = new int[] {1}; } else { relevantLevels = levels; } for (final int level : relevantLevels) { compressor.setCompressionLevel(level); ByteArrayOutputStream buffer = new ByteArrayOutputStream(); try { compressor.compress(new ByteArrayInputStream(CorpusHolder.CORPUS_INSTANCE), buffer); } catch (IOException e) { throw new RuntimeException(e); } byte[] compressedData = buffer.toByteArray(); digester.reset(); byte[] sha256OfCompressedData = digester.digest(compressedData); String sha256String = hexString(sha256OfCompressedData); JreDeflateParameters parameters = JreDeflateParameters.of(level, strategy, nowrap); result.put(parameters, sha256String); } } } compressor.release(); return result; }  Map<JreDeflateParameters, String> getBaselineValues(); byte[] getCorpus(); boolean isCompatible(); Map<JreDeflateParameters, String> getIncompatibleValues(); Map<JreDeflateParameters, String> getSystemValues();  }