Class MD5OutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.FilterOutputStream
-
- com.twmacinta.util.MD5OutputStream
-
- All Implemented Interfaces:
- java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable
public class MD5OutputStream extends java.io.FilterOutputStreamMD5OutputStream is a subclass of FilterOutputStream adding MD5GET hashing of the output.Originally written by Santeri Paavolainen, Helsinki Finland 1996
(c) Santeri Paavolainen, Helsinki Finland 1996
Some changes Copyright (c) 2002 Timothy W Macinta
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.
You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
See http://www.twmacinta.com/myjava/fast_md5.php for more information on this file.
Please note: I (Timothy Macinta) have put this code in the com.twmacinta.util package only because it came without a package. I was not the the original author of the code, although I did optimize it (substantially) and fix some bugs.
-
-
Constructor Summary
Constructors Constructor and Description MD5OutputStream(java.io.OutputStream out)Creates MD5OutputStream
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description MD5GETgetMD5()byte[]hash()Returns array of bytes representing hash of the stream as finalized for the current state.static voidmain(java.lang.String[] arg)This method is here for testing purposes only - do not rely on it being here.voidwrite(byte[] b, int off, int len)Writes a sub array of bytes.voidwrite(int b)Writes a byte.
-
-
-
Constructor Detail
-
MD5OutputStream
public MD5OutputStream(java.io.OutputStream out)
Creates MD5OutputStream- Parameters:
out- The output stream
-
-
Method Detail
-
write
public void write(int b) throws java.io.IOExceptionWrites a byte.- Overrides:
writein classjava.io.FilterOutputStream- Throws:
java.io.IOException- See Also:
FilterOutputStream
-
write
public void write(byte[] b, int off, int len) throws java.io.IOExceptionWrites a sub array of bytes.- Overrides:
writein classjava.io.FilterOutputStream- Throws:
java.io.IOException- See Also:
FilterOutputStream
-
hash
public byte[] hash()
Returns array of bytes representing hash of the stream as finalized for the current state.- See Also:
MD5GET.Final()
-
getMD5
public MD5GET getMD5()
-
main
public static void main(java.lang.String[] arg)
This method is here for testing purposes only - do not rely on it being here.
-
-
DMelt 3.0 © DataMelt by jWork.ORG