Code example for Inflater

Methods: inflateneedsDictionaryneedsInputsetInput

0
		// test method of java.util.zip.inflater.needsDictionary() 
		// note: this flag is set after inflate is called 
		byte outPutInf[] = new byte[500];
 
		// testing with dictionary set. 
		Inflater inflateDiction = new Inflater();
		if (inflateDiction.needsInput()) {
			inflateDiction.setInput(outPutDiction);
		} 
		try { 
			assertEquals("should return 0 because needs dictionary",
					0, inflateDiction.inflate(outPutInf));
		} catch (DataFormatException e) {
			fail("Should not cause exception");
		} 
		assertTrue(
				"method needsDictionary returned false when dictionary was used in deflater", 
				inflateDiction.needsDictionary());
 
		// testing without dictionary 
		Inflater inflate = new Inflater();
		try { 
			inflate.setInput(outPutBuff1);
Stop searching for code, let great code find you!  Add Codota to your java IDE