• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 *******************************************************************************/
29 package gov.nist.javax.sip.header;
30 
31 import javax.sip.InvalidArgumentException;
32 import javax.sip.header.*;
33 
34 /**
35  * MimeVersion SIP Header.
36  *
37  * @version 1.2 $Revision: 1.6 $ $Date: 2009/10/18 13:46:35 $
38  * @since 1.1
39  *
40  * @author M. Ranganathan   <br/>
41  * @author Olivier Deruelle <br/>
42  *
43  *
44  */
45 public class MimeVersion extends SIPHeader implements MimeVersionHeader {
46 
47     /**
48      * Comment for <code>serialVersionUID</code>
49      */
50     private static final long serialVersionUID = -7951589626435082068L;
51 
52     /**
53      * mimeVersion field
54      */
55     protected int minorVersion;
56 
57     /**
58      * majorVersion field
59      */
60     protected int majorVersion;
61 
62     /**
63      * Default constructor
64      */
MimeVersion()65     public MimeVersion() {
66         super(MIME_VERSION);
67     }
68 
69     /**
70      * Gets the Minor version value of this MimeVersionHeader.
71      *
72      * @return the Minor version of this MimeVersionHeader
73      */
getMinorVersion()74     public int getMinorVersion() {
75         return minorVersion;
76     }
77 
78     /**
79     * Gets the Major version value of this MimeVersionHeader.
80     *
81     * @return the Major version of this MimeVersionHeader
82     */
getMajorVersion()83     public int getMajorVersion() {
84         return majorVersion;
85     }
86 
87     /**
88      * Sets the Minor-Version argument of this MimeVersionHeader to the supplied
89      * <var>minorVersion</var> value.
90      *
91      * @param minorVersion - the new integer Minor version
92      * @throws InvalidArgumentException
93      */
setMinorVersion(int minorVersion)94     public void setMinorVersion(int minorVersion)
95         throws InvalidArgumentException {
96         if (minorVersion < 0)
97             throw new InvalidArgumentException(
98                 "JAIN-SIP Exception"
99                     + ", MimeVersion, setMinorVersion(), the minorVersion parameter is null");
100         this.minorVersion = minorVersion;
101     }
102 
103     /**
104      * Sets the Major-Version argument of this MimeVersionHeader to the supplied
105      * <var>majorVersion</var> value.
106      *
107      * @param majorVersion - the new integer Major version
108      * @throws InvalidArgumentException
109      */
setMajorVersion(int majorVersion)110     public void setMajorVersion(int majorVersion)
111         throws InvalidArgumentException {
112         if (majorVersion < 0)
113             throw new InvalidArgumentException(
114                 "JAIN-SIP Exception"
115                     + ", MimeVersion, setMajorVersion(), the majorVersion parameter is null");
116         this.majorVersion = majorVersion;
117     }
118 
119     /**
120      * Return canonical form.
121      * @return String
122      */
encodeBody()123     public String encodeBody() {
124         return Integer.toString(majorVersion)
125             + DOT
126             + Integer.toString(minorVersion);
127     }
128 
129 }
130 /*
131  * $Log: MimeVersion.java,v $
132  * Revision 1.6  2009/10/18 13:46:35  deruelle_jean
133  * FindBugs Fixes (Category Performance Warnings)
134  *
135  * Issue number:
136  * Obtained from:
137  * Submitted by: Jean Deruelle
138  * Reviewed by:
139  *
140  * Revision 1.5  2009/07/17 18:57:32  emcho
141  * Converts indentation tabs to spaces so that we have a uniform indentation policy in the whole project.
142  *
143  * Revision 1.4  2006/07/13 09:01:33  mranga
144  * Issue number:
145  * Obtained from:
146  * Submitted by:  jeroen van bemmel
147  * Reviewed by:   mranga
148  * Moved some changes from jain-sip-1.2 to java.net
149  *
150  * CVS: ----------------------------------------------------------------------
151  * CVS: Issue number:
152  * CVS:   If this change addresses one or more issues,
153  * CVS:   then enter the issue number(s) here.
154  * CVS: Obtained from:
155  * CVS:   If this change has been taken from another system,
156  * CVS:   then name the system in this line, otherwise delete it.
157  * CVS: Submitted by:
158  * CVS:   If this code has been contributed to the project by someone else; i.e.,
159  * CVS:   they sent us a patch or a set of diffs, then include their name/email
160  * CVS:   address here. If this is your work then delete this line.
161  * CVS: Reviewed by:
162  * CVS:   If we are doing pre-commit code reviews and someone else has
163  * CVS:   reviewed your changes, include their name(s) here.
164  * CVS:   If you have not had it reviewed then delete this line.
165  *
166  * Revision 1.3  2006/06/19 06:47:26  mranga
167  * javadoc fixups
168  *
169  * Revision 1.2  2006/06/16 15:26:28  mranga
170  * Added NIST disclaimer to all public domain files. Clean up some javadoc. Fixed a leak
171  *
172  * Revision 1.1.1.1  2005/10/04 17:12:34  mranga
173  *
174  * Import
175  *
176  *
177  * Revision 1.2  2004/01/22 13:26:29  sverker
178  * Issue number:
179  * Obtained from:
180  * Submitted by:  sverker
181  * Reviewed by:   mranga
182  *
183  * Major reformat of code to conform with style guide. Resolved compiler and javadoc warnings. Added CVS tags.
184  *
185  * CVS: ----------------------------------------------------------------------
186  * CVS: Issue number:
187  * CVS:   If this change addresses one or more issues,
188  * CVS:   then enter the issue number(s) here.
189  * CVS: Obtained from:
190  * CVS:   If this change has been taken from another system,
191  * CVS:   then name the system in this line, otherwise delete it.
192  * CVS: Submitted by:
193  * CVS:   If this code has been contributed to the project by someone else; i.e.,
194  * CVS:   they sent us a patch or a set of diffs, then include their name/email
195  * CVS:   address here. If this is your work then delete this line.
196  * CVS: Reviewed by:
197  * CVS:   If we are doing pre-commit code reviews and someone else has
198  * CVS:   reviewed your changes, include their name(s) here.
199  * CVS:   If you have not had it reviewed then delete this line.
200  *
201  */
202