question: public void testSkip ( ) throws Exception { byte [ ] data = new byte [ ] { - 127 , - 100 , - 50 , - 10 , - 1 , 0 , 1 , 10 , 50 , 127 } ; TestInputStream tis = new TestInputStream ( data ) ; CipherInputStream cis = new CipherInputStream ( tis , new NullCipher ( ) ) ; int expected = data . length ; byte [ ] result = new byte [ expected ] ; int skipped = ( int ) cis . skip ( 2 ) ; int ind = skipped ; int got = skipped + cis . read ( result , 0 , 1 ) ; while ( true ) { for ( int j = 0 ; j < got - ind ; j ++ ) { if ( result [ j ] != data [ ind + j ] ) { fail ( "read(byte[] b, int off, int len) " + "returned incorrect data: Expected " + data [ ind + j ] + ", got: " + result [ j ] ) ; } } if ( got == expected ) { break ; } else if ( got > expected ) { fail ( "The data returned by " + "read(byte[] b, int off, int len) " + "is larger than expected." ) ; } else { ind = got ; got += cis . read ( result , 0 , 1 ) ; } } if ( ( got = cis . read ( result , 0 , 1 ) ) != - 1 ) { fail ( "read() should return -1 at the end of the stream. " + "Output is: " + got + "." ) ; } }
target:  skip(long n) method testing. Tests that the method correctly skips the bytes.