Code example for DigestOutputStream

Methods: getMessageDigest, on, write

0
        } catch (IndexOutOfBoundsException e) {
        } 
        // len < 0 
        try { 
            dig.write(bytes, 0, -1);
            fail("No expected IndexOutOfBoundsException");
        } catch (IndexOutOfBoundsException e) {
        } 
    } 
 
    /** 
     * @tests java.io.DigestOutputStream#write(byte[], int, int) 
     */ 
    @TestTargetNew( 
        level = TestLevel.PARTIAL_COMPLETE, 
        notes = "IOException check.", 
        method = "write", 
        args = {byte[].class, int.class, int.class} 
    )     
    public void test_write$BII_7()  
        throws IOException, NoSuchAlgorithmException { 
        Support_OutputStream sos = new Support_OutputStream(MY_MESSAGE_LEN);
        MessageDigest md = MessageDigest.getInstance(algorithmName[0]);
        DigestOutputStream dos = new DigestOutputStream(sos, md);