question: public void testWrite3 ( ) throws Exception { byte [ ] data = new byte [ ] { - 127 , - 100 , - 50 , - 10 , - 1 , 0 , 1 , 10 , 50 , 127 } ; TestOutputStream tos = new TestOutputStream ( ) ; CipherOutputStream cos = new CipherOutputStream ( tos , new NullCipher ( ) ) ; for ( int i = 0 ; i < data . length ; i ++ ) { cos . write ( data , i , 1 ) ; } cos . flush ( ) ; byte [ ] result = tos . toByteArray ( ) ; if ( ! Arrays . equals ( result , data ) ) { fail ( "CipherOutputStream wrote incorrect data." ) ; } }
target:  write(byte[] b, int off, int len) method testing.