All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jcp.xml.dsig.internal.DigesterOutputStream Maven / Gradle / Ivy

The newest version!
/*    */ package org.jcp.xml.dsig.internal;
/*    */ 
/*    */ import java.io.ByteArrayOutputStream;
/*    */ import java.security.MessageDigest;
/*    */ import java.util.logging.Level;
/*    */ import java.util.logging.Logger;
/*    */ 
/*    */ public class DigesterOutputStream extends ByteArrayOutputStream
/*    */ {
/* 39 */   private static final byte[] none = "error".getBytes();
/*    */   private final MessageDigest md;
/* 41 */   private static Logger log = Logger.getLogger("org.jcp.xml.dsig.internal");
/*    */ 
/*    */   public DigesterOutputStream(MessageDigest md) {
/* 44 */     this.md = md;
/*    */   }
/*    */ 
/*    */   public byte[] toByteArray()
/*    */   {
/* 49 */     return none;
/*    */   }
/*    */ 
/*    */   public void write(byte[] input)
/*    */   {
/* 54 */     this.md.update(input);
/*    */   }
/*    */ 
/*    */   public void write(int input)
/*    */   {
/* 59 */     this.md.update((byte)input);
/*    */   }
/*    */ 
/*    */   public void write(byte[] input, int offset, int len)
/*    */   {
/* 64 */     if (log.isLoggable(Level.FINER)) {
/* 65 */       log.log(Level.FINER, "Pre-digested input:");
/* 66 */       StringBuffer sb = new StringBuffer(len);
/* 67 */       for (int i = offset; i < offset + len; i++) {
/* 68 */         sb.append((char)input[i]);
/*    */       }
/* 70 */       log.log(Level.FINER, sb.toString());
/*    */     }
/* 72 */     this.md.update(input, offset, len);
/*    */   }
/*    */ 
/*    */   public byte[] getDigestValue()
/*    */   {
/* 79 */     return this.md.digest();
/*    */   }
/*    */ }

/* Location:           E:\HYN\Java\trunk\ref\lib-dep\xmldsig\xmldsig.jar
 * Qualified Name:     org.jcp.xml.dsig.internal.DigesterOutputStream
 * JD-Core Version:    0.6.2
 */




© 2015 - 2024 Weber Informatics LLC | Privacy Policy