1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
5
<!-- Generated by javadoc on Sun Oct 10 17:41:04 EDT 2004 -->
7
HttpClient 2.0.2 API: Class AutoCloseInputStream
9
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
11
<BODY BGCOLOR="white">
13
<!-- ========== START OF NAVBAR ========== -->
14
<A NAME="navbar_top"><!-- --></A>
15
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
17
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
18
<A NAME="navbar_top_firstrow"><!-- --></A>
19
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
20
<TR ALIGN="center" VALIGN="top">
21
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
22
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
23
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
24
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/AutoCloseInputStream.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
25
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
26
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
27
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
28
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
32
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
38
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
39
<A HREF="../../../../org/apache/commons/httpclient/Authenticator.html"><B>PREV CLASS</B></A>
40
<A HREF="../../../../org/apache/commons/httpclient/ChunkedInputStream.html"><B>NEXT CLASS</B></A></FONT></TD>
41
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
42
<A HREF="../../../../index.html" TARGET="_top"><B>FRAMES</B></A>
43
<A HREF="AutoCloseInputStream.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
46
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
47
SUMMARY: INNER | <A HREF="#fields_inherited_from_class_java.io.FilterInputStream">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
48
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
49
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
52
<!-- =========== END OF NAVBAR =========== -->
55
<!-- ======== START OF CLASS DATA ======== -->
58
org.apache.commons.httpclient</FONT>
60
Class AutoCloseInputStream</H2>
62
<A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/lang/Object.html">java.lang.Object</A>
64
+--<A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/io/InputStream.html">java.io.InputStream</A>
66
+--<A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterInputStream.html">java.io.FilterInputStream</A>
68
+--<B>org.apache.commons.httpclient.AutoCloseInputStream</B>
72
<DT> class <B>AutoCloseInputStream</B><DT>extends <A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterInputStream.html">FilterInputStream</A></DL>
75
Closes an underlying stream as soon as the end of the stream is reached, and
76
notifies a client when it has done so.
79
<DT><B>Since: </B><DD>2.0</DD>
80
<DT><B>Author: </B><DD>Ortwin Gl?ck, Eric Johnson, <a href="mailto:mbowler@GargoyleSoftware.com">Mike Bowler</a></DD>
85
<!-- ======== INNER CLASS SUMMARY ======== -->
88
<!-- =========== FIELD SUMMARY =========== -->
90
<A NAME="fields_inherited_from_class_java.io.FilterInputStream"><!-- --></A>
91
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
92
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
93
<TD><B>Fields inherited from class java.io.<A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterInputStream.html">FilterInputStream</A></B></TD>
95
<TR BGCOLOR="white" CLASS="TableRowColor">
96
<TD><CODE><A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterInputStream.html#in">in</A></CODE></TD>
100
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
102
<A NAME="constructor_summary"><!-- --></A>
103
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
104
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
105
<TD COLSPAN=2><FONT SIZE="+2">
106
<B>Constructor Summary</B></FONT></TD>
108
<TR BGCOLOR="white" CLASS="TableRowColor">
109
<TD><CODE><B><A HREF="../../../../org/apache/commons/httpclient/AutoCloseInputStream.html#AutoCloseInputStream(java.io.InputStream, org.apache.commons.httpclient.ResponseConsumedWatcher)">AutoCloseInputStream</A></B>(<A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/io/InputStream.html">InputStream</A> in,
110
<A HREF="../../../../org/apache/commons/httpclient/ResponseConsumedWatcher.html">ResponseConsumedWatcher</A> watcher)</CODE>
113
Create a new auto closing stream for the provided connection</TD>
117
<!-- ========== METHOD SUMMARY =========== -->
119
<A NAME="method_summary"><!-- --></A>
120
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
121
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
122
<TD COLSPAN=2><FONT SIZE="+2">
123
<B>Method Summary</B></FONT></TD>
125
<TR BGCOLOR="white" CLASS="TableRowColor">
126
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
127
<CODE> void</CODE></FONT></TD>
128
<TD><CODE><B><A HREF="../../../../org/apache/commons/httpclient/AutoCloseInputStream.html#close()">close</A></B>()</CODE>
131
Close the stream, and also close the underlying stream if it is not
134
<TR BGCOLOR="white" CLASS="TableRowColor">
135
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
136
<CODE> int</CODE></FONT></TD>
137
<TD><CODE><B><A HREF="../../../../org/apache/commons/httpclient/AutoCloseInputStream.html#read()">read</A></B>()</CODE>
140
Reads the next byte of data from the input stream.</TD>
142
<TR BGCOLOR="white" CLASS="TableRowColor">
143
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
144
<CODE> int</CODE></FONT></TD>
145
<TD><CODE><B><A HREF="../../../../org/apache/commons/httpclient/AutoCloseInputStream.html#read(byte[])">read</A></B>(byte[] b)</CODE>
148
Reads some number of bytes from the input stream and stores them into the
151
<TR BGCOLOR="white" CLASS="TableRowColor">
152
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
153
<CODE> int</CODE></FONT></TD>
154
<TD><CODE><B><A HREF="../../../../org/apache/commons/httpclient/AutoCloseInputStream.html#read(byte[], int, int)">read</A></B>(byte[] b,
159
Reads up to <code>len</code> bytes of data from the stream.</TD>
162
<A NAME="methods_inherited_from_class_java.io.FilterInputStream"><!-- --></A>
163
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
164
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
165
<TD><B>Methods inherited from class java.io.<A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterInputStream.html">FilterInputStream</A></B></TD>
167
<TR BGCOLOR="white" CLASS="TableRowColor">
168
<TD><CODE><A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterInputStream.html#available()">available</A>, <A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterInputStream.html#mark(int)">mark</A>, <A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterInputStream.html#markSupported()">markSupported</A>, <A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterInputStream.html#reset()">reset</A>, <A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterInputStream.html#skip(long)">skip</A></CODE></TD>
171
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
172
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
173
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
174
<TD><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/lang/Object.html">Object</A></B></TD>
176
<TR BGCOLOR="white" CLASS="TableRowColor">
177
<TD><CODE><A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/lang/Object.html#<clinit>()"><clinit></A>, <A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/lang/Object.html#clone()">clone</A>, <A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/lang/Object.html#equals(java.lang.Object)">equals</A>, <A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/lang/Object.html#finalize()">finalize</A>, <A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/lang/Object.html#getClass()">getClass</A>, <A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/lang/Object.html#hashCode()">hashCode</A>, <A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/lang/Object.html#notify()">notify</A>, <A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/lang/Object.html#notifyAll()">notifyAll</A>, <A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/lang/Object.html#toString()">toString</A>, <A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/lang/Object.html#wait()">wait</A>, <A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/lang/Object.html#wait(long)">wait</A>, <A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/lang/Object.html#wait(long, int)">wait</A></CODE></TD>
183
<!-- ============ FIELD DETAIL =========== -->
186
<!-- ========= CONSTRUCTOR DETAIL ======== -->
188
<A NAME="constructor_detail"><!-- --></A>
189
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
190
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
191
<TD COLSPAN=1><FONT SIZE="+2">
192
<B>Constructor Detail</B></FONT></TD>
196
<A NAME="AutoCloseInputStream(java.io.InputStream, org.apache.commons.httpclient.ResponseConsumedWatcher)"><!-- --></A><H3>
197
AutoCloseInputStream</H3>
199
public <B>AutoCloseInputStream</B>(<A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/io/InputStream.html">InputStream</A> in,
200
<A HREF="../../../../org/apache/commons/httpclient/ResponseConsumedWatcher.html">ResponseConsumedWatcher</A> watcher)</PRE>
202
<DD>Create a new auto closing stream for the provided connection<DD><DL>
203
<DT><B>Parameters:</B><DD><CODE>in</CODE> - the input stream to read from<DD><CODE>watcher</CODE> - To be notified when the contents of the stream have been
208
<!-- ============ METHOD DETAIL ========== -->
210
<A NAME="method_detail"><!-- --></A>
211
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
212
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
213
<TD COLSPAN=1><FONT SIZE="+2">
214
<B>Method Detail</B></FONT></TD>
218
<A NAME="read()"><!-- --></A><H3>
221
public int <B>read</B>()
222
throws <A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/io/IOException.html">IOException</A></PRE>
224
<DD>Reads the next byte of data from the input stream.<DD><DL>
225
<DT><B>Overrides:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterInputStream.html#read()">read</A></CODE> in class <CODE><A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterInputStream.html">FilterInputStream</A></CODE></DL>
228
<DT><B>Returns:</B><DD>the character read, or -1 for EOF<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/io/IOException.html">IOException</A></CODE> - when there is an error reading</DL>
233
<A NAME="read(byte[], int, int)"><!-- --></A><H3>
236
public int <B>read</B>(byte[] b,
239
throws <A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/io/IOException.html">IOException</A></PRE>
241
<DD>Reads up to <code>len</code> bytes of data from the stream.<DD><DL>
242
<DT><B>Overrides:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterInputStream.html#read(byte[], int, int)">read</A></CODE> in class <CODE><A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterInputStream.html">FilterInputStream</A></CODE></DL>
245
<DT><B>Parameters:</B><DD><CODE>b</CODE> - a <code>byte</code> array to read data into<DD><CODE>off</CODE> - an offset within the array to store data<DD><CODE>len</CODE> - the maximum number of bytes to read<DT><B>Returns:</B><DD>the number of bytes read or -1 for EOF<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/io/IOException.html">IOException</A></CODE> - if there are errors reading</DL>
250
<A NAME="read(byte[])"><!-- --></A><H3>
253
public int <B>read</B>(byte[] b)
254
throws <A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/io/IOException.html">IOException</A></PRE>
256
<DD>Reads some number of bytes from the input stream and stores them into the
257
buffer array b.<DD><DL>
258
<DT><B>Overrides:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterInputStream.html#read(byte[])">read</A></CODE> in class <CODE><A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterInputStream.html">FilterInputStream</A></CODE></DL>
261
<DT><B>Parameters:</B><DD><CODE>b</CODE> - a <code>byte</code> array to read data into<DT><B>Returns:</B><DD>the number of bytes read or -1 for EOF<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/io/IOException.html">IOException</A></CODE> - if there are errors reading</DL>
266
<A NAME="close()"><!-- --></A><H3>
269
public void <B>close</B>()
270
throws <A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/io/IOException.html">IOException</A></PRE>
272
<DD>Close the stream, and also close the underlying stream if it is not
273
already closed.<DD><DL>
274
<DT><B>Overrides:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterInputStream.html#close()">close</A></CODE> in class <CODE><A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterInputStream.html">FilterInputStream</A></CODE></DL>
277
<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.4.1/docs/api/java/io/IOException.html">IOException</A></CODE> - If an IO problem occurs.</DL>
280
<!-- ========= END OF CLASS DATA ========= -->
283
<!-- ========== START OF NAVBAR ========== -->
284
<A NAME="navbar_bottom"><!-- --></A>
285
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
287
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
288
<A NAME="navbar_bottom_firstrow"><!-- --></A>
289
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
290
<TR ALIGN="center" VALIGN="top">
291
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
292
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
293
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
294
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/AutoCloseInputStream.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
295
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
296
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
297
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
298
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
302
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
308
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
309
<A HREF="../../../../org/apache/commons/httpclient/Authenticator.html"><B>PREV CLASS</B></A>
310
<A HREF="../../../../org/apache/commons/httpclient/ChunkedInputStream.html"><B>NEXT CLASS</B></A></FONT></TD>
311
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
312
<A HREF="../../../../index.html" TARGET="_top"><B>FRAMES</B></A>
313
<A HREF="AutoCloseInputStream.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
316
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
317
SUMMARY: INNER | <A HREF="#fields_inherited_from_class_java.io.FilterInputStream">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
318
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
319
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
322
<!-- =========== END OF NAVBAR =========== -->
325
Copyright © 2001-2004 Apache Software Foundation. All Rights Reserved.