Code example for Inflater

Methods: getRemaining, reset, setInput

0
	public void test_setInput$BII() { 
		// test method of java.util.zip.inflater.setInput(byte,int,int) 
		byte byteArray[] = { 2, 3, 4, 't', 'y', 'u', 'e', 'w', 7, 6, 5, 9 };
		int offSet = 6;
		int length = 6;
		Inflater inflate = new Inflater();
		inflate.setInput(byteArray, offSet, length);
		assertTrue(
				"setInputBII did not deliver the right number of bytes to the input buffer", 
				inflate.getRemaining() == length);
		// boundary check 
		inflate.reset();
		int r = 0;
		try { 
			inflate.setInput(byteArray, 100, 100);
		} catch (ArrayIndexOutOfBoundsException e) {
			r = 1;
		} 
		assertEquals("boundary check is not present for setInput", 1, r);
	}