Class Digester<T extends Digest>

  • All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable

    public abstract class Digester<T extends Digest>
    extends java.io.OutputStream
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.security.MessageDigest md  
    • Constructor Summary

      Constructors 
      Constructor Description
      Digester​(java.security.MessageDigest instance, java.io.OutputStream... out)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract T digest()  
      abstract T digest​(byte[] bytes)  
      T from​(byte[] f)  
      T from​(java.io.File f)  
      T from​(java.io.InputStream in)  
      abstract java.lang.String getAlgorithm()  
      int getLength()  
      java.security.MessageDigest getMessageDigest()  
      void setOutputs​(java.io.OutputStream... out)  
      void write​(byte[] buffer, int offset, int length)  
      void write​(int b)  
      • Methods inherited from class java.io.OutputStream

        close, flush, nullOutputStream, write
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • md

        protected java.security.MessageDigest md
    • Constructor Detail

      • Digester

        public Digester​(java.security.MessageDigest instance,
                        java.io.OutputStream... out)
    • Method Detail

      • write

        public void write​(byte[] buffer,
                          int offset,
                          int length)
                   throws java.io.IOException
        Overrides:
        write in class java.io.OutputStream
        Throws:
        java.io.IOException
      • write

        public void write​(int b)
                   throws java.io.IOException
        Specified by:
        write in class java.io.OutputStream
        Throws:
        java.io.IOException
      • getMessageDigest

        public java.security.MessageDigest getMessageDigest()
                                                     throws java.lang.Exception
        Throws:
        java.lang.Exception
      • from

        public T from​(java.io.InputStream in)
               throws java.lang.Exception
        Throws:
        java.lang.Exception
      • setOutputs

        public void setOutputs​(java.io.OutputStream... out)
      • digest

        public abstract T digest()
                          throws java.lang.Exception
        Throws:
        java.lang.Exception
      • digest

        public abstract T digest​(byte[] bytes)
                          throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getAlgorithm

        public abstract java.lang.String getAlgorithm()
      • from

        public T from​(java.io.File f)
               throws java.lang.Exception
        Throws:
        java.lang.Exception
      • from

        public T from​(byte[] f)
               throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getLength

        public int getLength()