• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * $HeadURL: http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/EofSensorWatcher.java $
3  * $Revision: 552264 $
4  * $Date: 2007-07-01 02:37:47 -0700 (Sun, 01 Jul 2007) $
5  *
6  * ====================================================================
7  *
8  *  Licensed to the Apache Software Foundation (ASF) under one or more
9  *  contributor license agreements.  See the NOTICE file distributed with
10  *  this work for additional information regarding copyright ownership.
11  *  The ASF licenses this file to You under the Apache License, Version 2.0
12  *  (the "License"); you may not use this file except in compliance with
13  *  the License.  You may obtain a copy of the License at
14  *
15  *      http://www.apache.org/licenses/LICENSE-2.0
16  *
17  *  Unless required by applicable law or agreed to in writing, software
18  *  distributed under the License is distributed on an "AS IS" BASIS,
19  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20  *  See the License for the specific language governing permissions and
21  *  limitations under the License.
22  * ====================================================================
23  *
24  * This software consists of voluntary contributions made by many
25  * individuals on behalf of the Apache Software Foundation.  For more
26  * information on the Apache Software Foundation, please see
27  * <http://www.apache.org/>.
28  *
29  */
30 
31 package org.apache.http.conn;
32 
33 import java.io.InputStream;
34 import java.io.IOException;
35 
36 
37 /**
38  * A watcher for {@link EofSensorInputStream EofSensorInputStream}.
39  * Each stream will notify it's watcher at most once.
40  *
41  * @author <a href="mailto:rolandw at apache.org">Roland Weber</a>
42  *
43  *
44  * <!-- empty lines to avoid svn diff problems -->
45  * @version $Revision: 552264 $
46  *
47  * @since 4.0
48  *
49  * @deprecated Please use {@link java.net.URL#openConnection} instead.
50  *     Please visit <a href="http://android-developers.blogspot.com/2011/09/androids-http-clients.html">this webpage</a>
51  *     for further details.
52  */
53 @Deprecated
54 public interface EofSensorWatcher {
55 
56     /**
57      * Indicates that EOF is detected.
58      *
59      * @param wrapped   the underlying stream which has reached EOF
60      *
61      * @return  <code>true</code> if <code>wrapped</code> should be closed,
62      *          <code>false</code> if it should be left alone
63      *
64      * @throws IOException
65      *         in case of an IO problem, for example if the watcher itself
66      *         closes the underlying stream. The caller will leave the
67      *         wrapped stream alone, as if <code>false</code> was returned.
68      */
eofDetected(InputStream wrapped)69     boolean eofDetected(InputStream wrapped)
70         throws IOException
71         ;
72 
73 
74     /**
75      * Indicates that the {@link EofSensorInputStream stream} is closed.
76      * This method will be called only if EOF was <i>not</i> detected
77      * before closing. Otherwise, {@link #eofDetected eofDetected} is called.
78      *
79      * @param wrapped   the underlying stream which has not reached EOF
80      *
81      * @return  <code>true</code> if <code>wrapped</code> should be closed,
82      *          <code>false</code> if it should be left alone
83      *
84      * @throws IOException
85      *         in case of an IO problem, for example if the watcher itself
86      *         closes the underlying stream. The caller will leave the
87      *         wrapped stream alone, as if <code>false</code> was returned.
88      */
streamClosed(InputStream wrapped)89     boolean streamClosed(InputStream wrapped)
90         throws IOException
91         ;
92 
93 
94     /**
95      * Indicates that the {@link EofSensorInputStream stream} is aborted.
96      * This method will be called only if EOF was <i>not</i> detected
97      * before aborting. Otherwise, {@link #eofDetected eofDetected} is called.
98      * <p/>
99      * This method will also be invoked when an input operation causes an
100      * IOException to be thrown to make sure the input stream gets shut down.
101      *
102      * @param wrapped   the underlying stream which has not reached EOF
103      *
104      * @return  <code>true</code> if <code>wrapped</code> should be closed,
105      *          <code>false</code> if it should be left alone
106      *
107      * @throws IOException
108      *         in case of an IO problem, for example if the watcher itself
109      *         closes the underlying stream. The caller will leave the
110      *         wrapped stream alone, as if <code>false</code> was returned.
111      */
streamAbort(InputStream wrapped)112     boolean streamAbort(InputStream wrapped)
113         throws IOException
114         ;
115 
116 
117 } // interface EofSensorWatcher
118