Wed, 31 Dec 2014 07:22:50 +0100
Correct previous dual key logic pending first delivery installment.
michael@0 | 1 | /* |
michael@0 | 2 | * ==================================================================== |
michael@0 | 3 | * Licensed to the Apache Software Foundation (ASF) under one |
michael@0 | 4 | * or more contributor license agreements. See the NOTICE file |
michael@0 | 5 | * distributed with this work for additional information |
michael@0 | 6 | * regarding copyright ownership. The ASF licenses this file |
michael@0 | 7 | * to you under the Apache License, Version 2.0 (the |
michael@0 | 8 | * "License"); you may not use this file except in compliance |
michael@0 | 9 | * with the License. You may obtain a copy of the License at |
michael@0 | 10 | * |
michael@0 | 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
michael@0 | 12 | * |
michael@0 | 13 | * Unless required by applicable law or agreed to in writing, |
michael@0 | 14 | * software distributed under the License is distributed on an |
michael@0 | 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
michael@0 | 16 | * KIND, either express or implied. See the License for the |
michael@0 | 17 | * specific language governing permissions and limitations |
michael@0 | 18 | * under the License. |
michael@0 | 19 | * ==================================================================== |
michael@0 | 20 | * |
michael@0 | 21 | * This software consists of voluntary contributions made by many |
michael@0 | 22 | * individuals on behalf of the Apache Software Foundation. For more |
michael@0 | 23 | * information on the Apache Software Foundation, please see |
michael@0 | 24 | * <http://www.apache.org/>. |
michael@0 | 25 | * |
michael@0 | 26 | */ |
michael@0 | 27 | |
michael@0 | 28 | package ch.boye.httpclientandroidlib.io; |
michael@0 | 29 | |
michael@0 | 30 | import java.io.IOException; |
michael@0 | 31 | |
michael@0 | 32 | import ch.boye.httpclientandroidlib.util.CharArrayBuffer; |
michael@0 | 33 | |
michael@0 | 34 | /** |
michael@0 | 35 | * Session output buffer for blocking connections. This interface is similar to |
michael@0 | 36 | * OutputStream class, but it also provides methods for writing lines of text. |
michael@0 | 37 | * <p> |
michael@0 | 38 | * Implementing classes are also expected to manage intermediate data buffering |
michael@0 | 39 | * for optimal output performance. |
michael@0 | 40 | * |
michael@0 | 41 | * @since 4.0 |
michael@0 | 42 | */ |
michael@0 | 43 | public interface SessionOutputBuffer { |
michael@0 | 44 | |
michael@0 | 45 | /** |
michael@0 | 46 | * Writes <code>len</code> bytes from the specified byte array |
michael@0 | 47 | * starting at offset <code>off</code> to this session buffer. |
michael@0 | 48 | * <p> |
michael@0 | 49 | * If <code>off</code> is negative, or <code>len</code> is negative, or |
michael@0 | 50 | * <code>off+len</code> is greater than the length of the array |
michael@0 | 51 | * <code>b</code>, then an <tt>IndexOutOfBoundsException</tt> is thrown. |
michael@0 | 52 | * |
michael@0 | 53 | * @param b the data. |
michael@0 | 54 | * @param off the start offset in the data. |
michael@0 | 55 | * @param len the number of bytes to write. |
michael@0 | 56 | * @exception IOException if an I/O error occurs. |
michael@0 | 57 | */ |
michael@0 | 58 | void write(byte[] b, int off, int len) throws IOException; |
michael@0 | 59 | |
michael@0 | 60 | /** |
michael@0 | 61 | * Writes <code>b.length</code> bytes from the specified byte array |
michael@0 | 62 | * to this session buffer. |
michael@0 | 63 | * |
michael@0 | 64 | * @param b the data. |
michael@0 | 65 | * @exception IOException if an I/O error occurs. |
michael@0 | 66 | */ |
michael@0 | 67 | void write(byte[] b) throws IOException; |
michael@0 | 68 | |
michael@0 | 69 | /** |
michael@0 | 70 | * Writes the specified byte to this session buffer. |
michael@0 | 71 | * |
michael@0 | 72 | * @param b the <code>byte</code>. |
michael@0 | 73 | * @exception IOException if an I/O error occurs. |
michael@0 | 74 | */ |
michael@0 | 75 | void write(int b) throws IOException; |
michael@0 | 76 | |
michael@0 | 77 | /** |
michael@0 | 78 | * Writes characters from the specified string followed by a line delimiter |
michael@0 | 79 | * to this session buffer. |
michael@0 | 80 | * <p> |
michael@0 | 81 | * The choice of a char encoding and line delimiter sequence is up to the |
michael@0 | 82 | * specific implementations of this interface. |
michael@0 | 83 | * |
michael@0 | 84 | * @param s the line. |
michael@0 | 85 | * @exception IOException if an I/O error occurs. |
michael@0 | 86 | */ |
michael@0 | 87 | void writeLine(String s) throws IOException; |
michael@0 | 88 | |
michael@0 | 89 | /** |
michael@0 | 90 | * Writes characters from the specified char array followed by a line |
michael@0 | 91 | * delimiter to this session buffer. |
michael@0 | 92 | * <p> |
michael@0 | 93 | * The choice of a char encoding and line delimiter sequence is up to the |
michael@0 | 94 | * specific implementations of this interface. |
michael@0 | 95 | * |
michael@0 | 96 | * @param buffer the buffer containing chars of the line. |
michael@0 | 97 | * @exception IOException if an I/O error occurs. |
michael@0 | 98 | */ |
michael@0 | 99 | void writeLine(CharArrayBuffer buffer) throws IOException; |
michael@0 | 100 | |
michael@0 | 101 | /** |
michael@0 | 102 | * Flushes this session buffer and forces any buffered output bytes |
michael@0 | 103 | * to be written out. The general contract of <code>flush</code> is |
michael@0 | 104 | * that calling it is an indication that, if any bytes previously |
michael@0 | 105 | * written have been buffered by the implementation of the output |
michael@0 | 106 | * stream, such bytes should immediately be written to their |
michael@0 | 107 | * intended destination. |
michael@0 | 108 | * |
michael@0 | 109 | * @exception IOException if an I/O error occurs. |
michael@0 | 110 | */ |
michael@0 | 111 | void flush() throws IOException; |
michael@0 | 112 | |
michael@0 | 113 | /** |
michael@0 | 114 | * Returns {@link HttpTransportMetrics} for this session buffer. |
michael@0 | 115 | * |
michael@0 | 116 | * @return transport metrics. |
michael@0 | 117 | */ |
michael@0 | 118 | HttpTransportMetrics getMetrics(); |
michael@0 | 119 | |
michael@0 | 120 | } |