View Javadoc

    1   /*
    2    * Copyright 2010 Red Hat, Inc.
    3    *
    4    * Red Hat licenses this file to you under the Apache License, version 2.0
    5    * (the "License"); you may not use this file except in compliance with the
    6    * License.  You may obtain a copy of the License at:
    7    *
    8    *    http://www.apache.org/licenses/LICENSE-2.0
    9    *
    10   * Unless required by applicable law or agreed to in writing, software
    11   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
    12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
    13   * License for the specific language governing permissions and limitations
    14   * under the License.
    15   */
    16  package org.jboss.netty.handler.codec.rtsp;
    17
    18  import org.jboss.netty.handler.codec.http.HttpVersion;
    19
    20  /**
    21   * The version of RTSP.
    22   *
    23   * @author <a href="http://www.jboss.org/netty/">The Netty Project</a>
    24   * @author <a href="http://amitbhayani.blogspot.com/">Amit Bhayani</a>
    25   * @author <a href="http://gleamynode.net/">Trustin Lee</a>
    26   * @version $Rev: 2243 $, $Date: 2010-04-16 14:01:55 +0900 (Fri, 16 Apr 2010) $
    27   *
    28   * @apiviz.exclude
    29   */
    30  public final class RtspVersions {
    31
    32      /**
    33       * RTSP/1.0
    34       */
    35      public static final HttpVersion RTSP_1_0 = new HttpVersion("RTSP", 1, 0, true);
    36
    37      /**
    38       * Returns an existing or new {@link HttpVersion} instance which matches to
    39       * the specified RTSP version string.  If the specified {@code text} is
    40       * equal to {@code "RTSP/1.0"}, {@link #RTSP_1_0} will be returned.
    41       * Otherwise, a new {@link HttpVersion} instance will be returned.
    42       */
    43      public static HttpVersion valueOf(String text) {
    44          if (text == null) {
    45              throw new NullPointerException("text");
    46          }
    47
    48          text = text.trim().toUpperCase();
    49          if (text.equals("RTSP/1.0")) {
    50              return RTSP_1_0;
    51          }
    52
    53          return new HttpVersion(text, true);
    54      }
    55
    56      private RtspVersions() {
    57          super();
    58      }
    59  }