Code example for CheckedInputStream

Methods: getChecksum, skip

0
	 * @tests java.util.zip.CheckedInputStream#skip(long) 
	 */ 
	public void test_skipJ() throws Exception { 
        // testing that the return by skip is valid 
        InputStream checkInput = Support_Resources.getStream("hyts_checkInput.txt");
        CheckedInputStream checkIn = new CheckedInputStream(checkInput, new CRC32());
        long skipValue = 5;
        assertEquals("the value returned by skip(n) is not the same as its parameter",
                skipValue, checkIn.skip(skipValue));
        checkIn.skip(skipValue);
        // ran JDK and found the checkSum value is 2235765342 
        // System.out.print(checkIn.getChecksum().getValue()); 
        assertEquals("checkSum value is not correct", 2235765342L, checkIn.getChecksum()
                .getValue());
        checkInput.close();
    } 
 
    public void test_read() throws Exception { 
        // testing that the return by skip is valid 
        InputStream checkInput = Support_Resources
                .getStream("hyts_checkInput.txt");