mobile/android/thirdparty/ch/boye/httpclientandroidlib/message/HeaderValueFormatter.java

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

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.message;
michael@0 29
michael@0 30 import ch.boye.httpclientandroidlib.HeaderElement;
michael@0 31 import ch.boye.httpclientandroidlib.NameValuePair;
michael@0 32 import ch.boye.httpclientandroidlib.util.CharArrayBuffer;
michael@0 33
michael@0 34 /**
michael@0 35 * Interface for formatting elements of a header value.
michael@0 36 * This is the complement to {@link HeaderValueParser}.
michael@0 37 * Instances of this interface are expected to be stateless and thread-safe.
michael@0 38 *
michael@0 39 * <p>
michael@0 40 * All formatting methods accept an optional buffer argument.
michael@0 41 * If a buffer is passed in, the formatted element will be appended
michael@0 42 * and the modified buffer is returned. If no buffer is passed in,
michael@0 43 * a new buffer will be created and filled with the formatted element.
michael@0 44 * In both cases, the caller is allowed to modify the returned buffer.
michael@0 45 * </p>
michael@0 46 *
michael@0 47 * @since 4.0
michael@0 48 */
michael@0 49 public interface HeaderValueFormatter {
michael@0 50
michael@0 51 /**
michael@0 52 * Formats an array of header elements.
michael@0 53 *
michael@0 54 * @param buffer the buffer to append to, or
michael@0 55 * <code>null</code> to create a new buffer
michael@0 56 * @param elems the header elements to format
michael@0 57 * @param quote <code>true</code> to always format with quoted values,
michael@0 58 * <code>false</code> to use quotes only when necessary
michael@0 59 *
michael@0 60 * @return a buffer with the formatted header elements.
michael@0 61 * If the <code>buffer</code> argument was not <code>null</code>,
michael@0 62 * that buffer will be used and returned.
michael@0 63 */
michael@0 64 CharArrayBuffer formatElements(CharArrayBuffer buffer,
michael@0 65 HeaderElement[] elems,
michael@0 66 boolean quote);
michael@0 67
michael@0 68 /**
michael@0 69 * Formats one header element.
michael@0 70 *
michael@0 71 * @param buffer the buffer to append to, or
michael@0 72 * <code>null</code> to create a new buffer
michael@0 73 * @param elem the header element to format
michael@0 74 * @param quote <code>true</code> to always format with quoted values,
michael@0 75 * <code>false</code> to use quotes only when necessary
michael@0 76 *
michael@0 77 * @return a buffer with the formatted header element.
michael@0 78 * If the <code>buffer</code> argument was not <code>null</code>,
michael@0 79 * that buffer will be used and returned.
michael@0 80 */
michael@0 81 CharArrayBuffer formatHeaderElement(CharArrayBuffer buffer,
michael@0 82 HeaderElement elem,
michael@0 83 boolean quote);
michael@0 84
michael@0 85 /**
michael@0 86 * Formats the parameters of a header element.
michael@0 87 * That's a list of name-value pairs, to be separated by semicolons.
michael@0 88 * This method will <i>not</i> generate a leading semicolon.
michael@0 89 *
michael@0 90 * @param buffer the buffer to append to, or
michael@0 91 * <code>null</code> to create a new buffer
michael@0 92 * @param nvps the parameters (name-value pairs) to format
michael@0 93 * @param quote <code>true</code> to always format with quoted values,
michael@0 94 * <code>false</code> to use quotes only when necessary
michael@0 95 *
michael@0 96 * @return a buffer with the formatted parameters.
michael@0 97 * If the <code>buffer</code> argument was not <code>null</code>,
michael@0 98 * that buffer will be used and returned.
michael@0 99 */
michael@0 100 CharArrayBuffer formatParameters(CharArrayBuffer buffer,
michael@0 101 NameValuePair[] nvps,
michael@0 102 boolean quote);
michael@0 103
michael@0 104 /**
michael@0 105 * Formats one name-value pair, where the value is optional.
michael@0 106 *
michael@0 107 * @param buffer the buffer to append to, or
michael@0 108 * <code>null</code> to create a new buffer
michael@0 109 * @param nvp the name-value pair to format
michael@0 110 * @param quote <code>true</code> to always format with a quoted value,
michael@0 111 * <code>false</code> to use quotes only when necessary
michael@0 112 *
michael@0 113 * @return a buffer with the formatted name-value pair.
michael@0 114 * If the <code>buffer</code> argument was not <code>null</code>,
michael@0 115 * that buffer will be used and returned.
michael@0 116 */
michael@0 117 CharArrayBuffer formatNameValuePair(CharArrayBuffer buffer,
michael@0 118 NameValuePair nvp,
michael@0 119 boolean quote);
michael@0 120
michael@0 121 }
michael@0 122

mercurial