mobile/android/thirdparty/ch/boye/httpclientandroidlib/message/BasicStatusLine.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.

     1 /*
     2  * ====================================================================
     3  * Licensed to the Apache Software Foundation (ASF) under one
     4  * or more contributor license agreements.  See the NOTICE file
     5  * distributed with this work for additional information
     6  * regarding copyright ownership.  The ASF licenses this file
     7  * to you under the Apache License, Version 2.0 (the
     8  * "License"); you may not use this file except in compliance
     9  * with 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,
    14  * software distributed under the License is distributed on an
    15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    16  * KIND, either express or implied.  See the License for the
    17  * specific language governing permissions and limitations
    18  * under the License.
    19  * ====================================================================
    20  *
    21  * This software consists of voluntary contributions made by many
    22  * individuals on behalf of the Apache Software Foundation.  For more
    23  * information on the Apache Software Foundation, please see
    24  * <http://www.apache.org/>.
    25  *
    26  */
    28 package ch.boye.httpclientandroidlib.message;
    30 import java.io.Serializable;
    32 import ch.boye.httpclientandroidlib.ProtocolVersion;
    33 import ch.boye.httpclientandroidlib.StatusLine;
    35 /**
    36  * Basic implementation of {@link StatusLine}
    37  *
    38  * @version $Id: BasicStatusLine.java 986952 2010-08-18 21:24:55Z olegk $
    39  *
    40  * @since 4.0
    41  */
    42 public class BasicStatusLine implements StatusLine, Cloneable, Serializable {
    44     private static final long serialVersionUID = -2443303766890459269L;
    46     // ----------------------------------------------------- Instance Variables
    48     /** The protocol version. */
    49     private final ProtocolVersion protoVersion;
    51     /** The status code. */
    52     private final int statusCode;
    54     /** The reason phrase. */
    55     private final String reasonPhrase;
    57     // ----------------------------------------------------------- Constructors
    58     /**
    59      * Creates a new status line with the given version, status, and reason.
    60      *
    61      * @param version           the protocol version of the response
    62      * @param statusCode        the status code of the response
    63      * @param reasonPhrase      the reason phrase to the status code, or
    64      *                          <code>null</code>
    65      */
    66     public BasicStatusLine(final ProtocolVersion version, int statusCode,
    67                            final String reasonPhrase) {
    68         super();
    69         if (version == null) {
    70             throw new IllegalArgumentException
    71                 ("Protocol version may not be null.");
    72         }
    73         if (statusCode < 0) {
    74             throw new IllegalArgumentException
    75                 ("Status code may not be negative.");
    76         }
    77         this.protoVersion = version;
    78         this.statusCode   = statusCode;
    79         this.reasonPhrase = reasonPhrase;
    80     }
    82     // --------------------------------------------------------- Public Methods
    84     public int getStatusCode() {
    85         return this.statusCode;
    86     }
    88     public ProtocolVersion getProtocolVersion() {
    89         return this.protoVersion;
    90     }
    92     public String getReasonPhrase() {
    93         return this.reasonPhrase;
    94     }
    96     public String toString() {
    97         // no need for non-default formatting in toString()
    98         return BasicLineFormatter.DEFAULT
    99             .formatStatusLine(null, this).toString();
   100     }
   102     public Object clone() throws CloneNotSupportedException {
   103         return super.clone();
   104     }
   106 }

mercurial