📄 digestinputstream.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc on Thu Apr 27 23:35:57 PDT 2000 --><TITLE>Java 2 Platform SE v1.3: Class DigestInputStream</TITLE><LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"></HEAD><BODY BGCOLOR="white"><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/DigestInputStream.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Std. Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../java/security/CodeSource.html"><B>PREV CLASS</B></A> <A HREF="../../java/security/DigestOutputStream.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="DigestInputStream.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">java.security</FONT><BR>Class DigestInputStream</H2><PRE><A HREF="../../java/lang/Object.html">java.lang.Object</A> | +--<A HREF="../../java/io/InputStream.html">java.io.InputStream</A> | +--<A HREF="../../java/io/FilterInputStream.html">java.io.FilterInputStream</A> | +--<B>java.security.DigestInputStream</B></PRE><HR><DL><DT>public class <B>DigestInputStream</B><DT>extends <A HREF="../../java/io/FilterInputStream.html">FilterInputStream</A></DL><P>A transparent stream that updates the associated message digest using the bits going through the stream. <p>To complete the message digest computation, call one of the <code>digest</code> methods on the associated message digest after your calls to one of this digest input stream's <A HREF="../../java/security/DigestInputStream.html#read()"><CODE>read</CODE></A> methods. <p>It is possible to turn this stream on or off (see <A HREF="../../java/security/DigestInputStream.html#on(boolean)"><CODE>on</CODE></A>). When it is on, a call to one of the <code>read</code> methods results in an update on the message digest. But when it is off, the message digest is not updated. The default is for the stream to be on. <p>Note that digest objects can compute only one digest (see <A HREF="../../java/security/MessageDigest.html"><CODE>MessageDigest</CODE></A>), so that in order to compute intermediate digests, a caller should retain a handle onto the digest object, and clone it for each digest to be computed, leaving the orginal digest untouched.<P><DL><DT><B>See Also: </B><DD><A HREF="../../java/security/MessageDigest.html"><CODE>MessageDigest</CODE></A>, <A HREF="../../java/security/DigestOutputStream.html"><CODE>DigestOutputStream</CODE></A></DL><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><A NAME="field_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Field Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected <A HREF="../../java/security/MessageDigest.html">MessageDigest</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/security/DigestInputStream.html#digest">digest</A></B></CODE><BR> The message digest associated with this stream.</TD></TR></TABLE> <A NAME="fields_inherited_from_class_java.io.FilterInputStream"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Fields inherited from class java.io.<A HREF="../../java/io/FilterInputStream.html">FilterInputStream</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../java/io/FilterInputStream.html#in">in</A></CODE></TD></TR></TABLE> <!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Constructor Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../java/security/DigestInputStream.html#DigestInputStream(java.io.InputStream, java.security.MessageDigest)">DigestInputStream</A></B>(<A HREF="../../java/io/InputStream.html">InputStream</A> stream, <A HREF="../../java/security/MessageDigest.html">MessageDigest</A> digest)</CODE><BR> Creates a digest input stream, using the specified input stream and message digest.</TD></TR></TABLE> <!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/security/MessageDigest.html">MessageDigest</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/security/DigestInputStream.html#getMessageDigest()">getMessageDigest</A></B>()</CODE><BR> Returns the message digest associated with this stream.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/security/DigestInputStream.html#on(boolean)">on</A></B>(boolean on)</CODE><BR> Turns the digest function on or off.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/security/DigestInputStream.html#read()">read</A></B>()</CODE><BR> Reads a byte, and updates the message digest (if the digest function is on).</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/security/DigestInputStream.html#read(byte[], int, int)">read</A></B>(byte[] b, int off, int len)</CODE><BR> Reads into a byte array, and updates the message digest (if the digest function is on).</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/security/DigestInputStream.html#setMessageDigest(java.security.MessageDigest)">setMessageDigest</A></B>(<A HREF="../../java/security/MessageDigest.html">MessageDigest</A> digest)</CODE><BR> Associates the specified message digest with this stream.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/security/DigestInputStream.html#toString()">toString</A></B>()</CODE><BR> Prints a string representation of this digest input stream and its associated message digest object.</TD></TR></TABLE> <A NAME="methods_inherited_from_class_java.io.FilterInputStream"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from class java.io.<A HREF="../../java/io/FilterInputStream.html">FilterInputStream</A></B></TD></TR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -