1 /* 2 * Conditions Of Use 3 * 4 * This software was developed by employees of the National Institute of 5 * Standards and Technology (NIST), an agency of the Federal Government. 6 * Pursuant to title 15 Untied States Code Section 105, works of NIST 7 * employees are not subject to copyright protection in the United States 8 * and are considered to be in the public domain. As a result, a formal 9 * license is not needed to use the software. 10 * 11 * This software is provided by NIST as a service and is expressly 12 * provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED 13 * OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF 14 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT 15 * AND DATA ACCURACY. NIST does not warrant or make any representations 16 * regarding the use of the software or the results thereof, including but 17 * not limited to the correctness, accuracy, reliability or usefulness of 18 * the software. 19 * 20 * Permission to use this software is contingent upon your acceptance 21 * of the terms of this agreement 22 * 23 * . 24 * 25 */ 26 /******************************************************************************* 27 * Product of NIST/ITL Advanced Networking Technologies Division (ANTD). * 28 * See ../../../../doc/uncopyright.html for conditions of use. * 29 * Author: M. Ranganathan (mranga (at) nist.gov) * 30 * Modified By: O. Deruelle (deruelle (at) nist.gov) * 31 * Questions/Comments: nist-sip-dev (at) antd.nist.gov * 32 *******************************************************************************/ 33 package gov.nist.javax.sip.header; 34 35 /** 36 * Media Range 37 * @see Accept 38 * @since 0.9 39 * @version 1.2 $Revision: 1.6 $ $Date: 2009/07/17 18:57:32 $ 40 * <pre> 41 * Revisions: 42 * 43 * Version 1.0 44 * 1. Added encode method. 45 * 46 * media-range = ( "STAR/STAR" 47 * | ( type "/" STAR ) 48 * | ( type "/" subtype ) 49 * ) *( ";" parameter ) 50 * 51 * HTTP RFC 2616 Section 14.1 52 * </pre> 53 */ 54 public class MediaRange extends SIPObject { 55 56 /** 57 * Comment for <code>serialVersionUID</code> 58 */ 59 private static final long serialVersionUID = -6297125815438079210L; 60 61 /** type field 62 */ 63 protected String type; 64 65 /** subtype field 66 */ 67 protected String subtype; 68 69 /** Default constructor 70 */ 71 public MediaRange() { 72 } 73 74 /** get type field 75 * @return String 76 */ 77 public String getType() { 78 return type; 79 } 80 81 /** get the subType field. 82 * @return String 83 */ 84 public String getSubtype() { 85 return subtype; 86 } 87 88 /** 89 * Set the type member 90 * @param t String to set 91 */ 92 public void setType(String t) { 93 type = t; 94 } 95 96 /** 97 * Set the subtype member 98 * @param s String to set 99 */ 100 public void setSubtype(String s) { 101 subtype = s; 102 } 103 104 /** 105 * Encode the object. 106 * @return String 107 */ 108 public String encode() { 109 return encode(new StringBuffer()).toString(); 110 } 111 112 public StringBuffer encode(StringBuffer buffer) { 113 return buffer.append(type) 114 .append(SLASH) 115 .append(subtype); 116 } 117 } 118