org.apache.http
Class HttpVersion

java.lang.Object
  extended by org.apache.http.HttpVersion
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable

public final class HttpVersion
extends java.lang.Object
implements java.lang.Comparable, java.io.Serializable

Represents an HTTP version, as specified in RFC 2616.

Version:
$Revision: 502704 $ $Date: 2007-02-02 20:54:54 +0100 (Fri, 02 Feb 2007) $
Author:
Oleg Kalnichevski
See Also:
Serialized Form

Field Summary
static HttpVersion HTTP_0_9
          HTTP protocol version 0.9
static HttpVersion HTTP_1_0
          HTTP protocol version 1.0
static HttpVersion HTTP_1_1
          HTTP protocol version 1.1
 
Constructor Summary
HttpVersion(int major, int minor)
          Create an HTTP protocol version designator.
 
Method Summary
 int compareTo(HttpVersion anotherVer)
          Compares this HTTP protocol version with another one.
 int compareTo(java.lang.Object o)
           
 boolean equals(HttpVersion version)
          Test if the HTTP protocol version is equal to the given number.
 boolean equals(java.lang.Object obj)
           
 int getMajor()
          Returns the major version number of the HTTP protocol.
 int getMinor()
          Returns the minor version number of the HTTP protocol.
 boolean greaterEquals(HttpVersion version)
          Test if the HTTP protocol version is greater or equal to the given number.
 int hashCode()
           
 boolean lessEquals(HttpVersion version)
          Test if the HTTP protocol version is less or equal to the given number.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

HTTP_0_9

public static final HttpVersion HTTP_0_9
HTTP protocol version 0.9


HTTP_1_0

public static final HttpVersion HTTP_1_0
HTTP protocol version 1.0


HTTP_1_1

public static final HttpVersion HTTP_1_1
HTTP protocol version 1.1

Constructor Detail

HttpVersion

public HttpVersion(int major,
                   int minor)
Create an HTTP protocol version designator.

Parameters:
major - the major version number of the HTTP protocol
minor - the minor version number of the HTTP protocol
Throws:
java.lang.IllegalArgumentException - if either major or minor version number is negative
Method Detail

getMajor

public int getMajor()
Returns the major version number of the HTTP protocol.

Returns:
the major version number.

getMinor

public int getMinor()
Returns the minor version number of the HTTP protocol.

Returns:
the minor version number.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

compareTo

public int compareTo(HttpVersion anotherVer)
Compares this HTTP protocol version with another one.

Parameters:
anotherVer - the version to be compared with.
Returns:
a negative integer, zero, or a positive integer as this version is less than, equal to, or greater than the specified version.

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable
See Also:
Comparable.compareTo(java.lang.Object)

equals

public boolean equals(HttpVersion version)
Test if the HTTP protocol version is equal to the given number.

Returns:
true if HTTP protocol version is given to the given number, false otherwise.

greaterEquals

public boolean greaterEquals(HttpVersion version)
Test if the HTTP protocol version is greater or equal to the given number.

Returns:
true if HTTP protocol version is greater or equal given to the given number, false otherwise.

lessEquals

public boolean lessEquals(HttpVersion version)
Test if the HTTP protocol version is less or equal to the given number.

Returns:
true if HTTP protocol version is less or equal to given to the given number, false otherwise.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()


Copyright © 2005-2009 Apache Software Foundation. All Rights Reserved.