Code example for DigestOutputStream

Methods: write

0
     */ 
    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);
 
        dos.write(myMessage, 0, MY_MESSAGE_LEN);
 
        try { 
            // Support_OutputStream throws an IOException if the internal 
            // buffer is full, which it should be now. 
            dos.write(myMessage, 0, MY_MESSAGE_LEN);
            fail("Test 1: IOException expected.");
        } catch (IOException e) {
            // Expected. 
        } 
    } 
 
    /** 
Experience pair programming with AI  Get Codota for Java