Wed, 31 Dec 2014 07:22:50 +0100
Correct previous dual key logic pending first delivery installment.
1 /*
2 * ====================================================================
3 *
4 * Licensed to the Apache Software Foundation (ASF) under one or more
5 * contributor license agreements. See the NOTICE file distributed with
6 * this work for additional information regarding copyright ownership.
7 * The ASF licenses this file to You under the Apache License, Version 2.0
8 * (the "License"); you may not use this file except in compliance with
9 * the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ====================================================================
19 *
20 * This software consists of voluntary contributions made by many
21 * individuals on behalf of the Apache Software Foundation. For more
22 * information on the Apache Software Foundation, please see
23 * <http://www.apache.org/>.
24 *
25 */
27 package ch.boye.httpclientandroidlib.conn;
29 import java.io.InputStream;
30 import java.io.IOException;
32 /**
33 * A watcher for {@link EofSensorInputStream}. Each stream will notify its
34 * watcher at most once.
35 *
36 * @since 4.0
37 */
38 public interface EofSensorWatcher {
40 /**
41 * Indicates that EOF is detected.
42 *
43 * @param wrapped the underlying stream which has reached EOF
44 *
45 * @return <code>true</code> if <code>wrapped</code> should be closed,
46 * <code>false</code> if it should be left alone
47 *
48 * @throws IOException
49 * in case of an IO problem, for example if the watcher itself
50 * closes the underlying stream. The caller will leave the
51 * wrapped stream alone, as if <code>false</code> was returned.
52 */
53 boolean eofDetected(InputStream wrapped)
54 throws IOException;
56 /**
57 * Indicates that the {@link EofSensorInputStream stream} is closed.
58 * This method will be called only if EOF was <i>not</i> detected
59 * before closing. Otherwise, {@link #eofDetected eofDetected} is called.
60 *
61 * @param wrapped the underlying stream which has not reached EOF
62 *
63 * @return <code>true</code> if <code>wrapped</code> should be closed,
64 * <code>false</code> if it should be left alone
65 *
66 * @throws IOException
67 * in case of an IO problem, for example if the watcher itself
68 * closes the underlying stream. The caller will leave the
69 * wrapped stream alone, as if <code>false</code> was returned.
70 */
71 boolean streamClosed(InputStream wrapped)
72 throws IOException;
74 /**
75 * Indicates that the {@link EofSensorInputStream stream} is aborted.
76 * This method will be called only if EOF was <i>not</i> detected
77 * before aborting. Otherwise, {@link #eofDetected eofDetected} is called.
78 * <p/>
79 * This method will also be invoked when an input operation causes an
80 * IOException to be thrown to make sure the input stream gets shut down.
81 *
82 * @param wrapped the underlying stream which has not reached EOF
83 *
84 * @return <code>true</code> if <code>wrapped</code> should be closed,
85 * <code>false</code> if it should be left alone
86 *
87 * @throws IOException
88 * in case of an IO problem, for example if the watcher itself
89 * closes the underlying stream. The caller will leave the
90 * wrapped stream alone, as if <code>false</code> was returned.
91 */
92 boolean streamAbort(InputStream wrapped)
93 throws IOException;
95 }