Produced by Araxis Merge on 9/25/2018 2:13:03 PM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
# | Location | File | Last Modified |
---|---|---|---|
1 | build 3.zip\build 3\MHLTH_YS_137_Source\JavaScript\resources\javaJDF-1.8.0\src\com\sun\jmx\snmp | SnmpIpAddress.java | Mon Jan 22 14:46:50 2018 UTC |
2 | build 3.zip\build 3\MHLTH_YS_137_Source\JavaScript\resources\javaJDF-1.8.0\src\com\sun\jmx\snmp | SnmpIpAddress.java | Wed Sep 12 16:26:24 2018 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 432 |
Changed | 1 | 2 |
Inserted | 0 | 0 |
Removed | 0 | 0 |
Whitespace | |
---|---|
Character case | Differences in character case are significant |
Line endings | Differences in line endings (CR and LF characters) are ignored |
CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
1 | /* | |
2 | * Copyrig ht (c) 199 7, 2007, O racle and/ or its aff iliates. A ll rights reserved. | |
3 | * DO NOT ALTER OR R EMOVE COPY RIGHT NOTI CES OR THI S FILE HEA DER. | |
4 | * | |
5 | * This co de is free software; you can r edistribut e it and/o r modify i t | |
6 | * under t he terms o f the GNU General Pu blic Licen se version 2 only, a s | |
7 | * publish ed by the Free Softw are Founda tion. Ora cle design ates this | |
8 | * particu lar file a s subject to the "Cl asspath" e xception a s provided | |
9 | * by Orac le in the LICENSE fi le that ac companied this code. | |
10 | * | |
11 | * This co de is dist ributed in the hope that it wi ll be usef ul, but WI THOUT | |
12 | * ANY WAR RANTY; wit hout even the implie d warranty of MERCHA NTABILITY or | |
13 | * FITNESS FOR A PAR TICULAR PU RPOSE. Se e the GNU General Pu blic Licen se | |
14 | * version 2 for mor e details (a copy is included in the LIC ENSE file that | |
15 | * accompa nied this code). | |
16 | * | |
17 | * You sho uld have r eceived a copy of th e GNU Gene ral Public License v ersion | |
18 | * 2 along with this work; if not, write to the Fr ee Softwar e Foundati on, | |
19 | * Inc., 5 1 Franklin St, Fifth Floor, Bo ston, MA 0 2110-1301 USA. | |
20 | * | |
21 | * Please contact Or acle, 500 Oracle Par kway, Redw ood Shores , CA 94065 USA | |
22 | * or visi t www.orac le.com if you need a dditional informatio n or have any | |
23 | * questio ns. | |
24 | */ | |
25 | ||
26 | ||
27 | package co m.sun.jmx. snmp; | |
28 | ||
29 | ||
30 | ||
31 | ||
32 | /** | |
33 | * Represe nts an SNM P IpAddres s. | |
34 | * | |
35 | * <p><b>T his API is a Sun Mic rosystems internal A PI and is subject | |
36 | * to chan ge without notice.</ b></p> | |
37 | */ | |
38 | ||
39 | public cla ss SnmpIpA ddress ext ends SnmpO id { | |
40 | privat e static f inal long serialVers ionUID = 7 2046299982 70874474L; | |
41 | ||
42 | // CON STRUCTORS | |
43 | //---- --------- | |
44 | /** | |
45 | * Con structs a new <CODE> SnmpIpAddr ess</CODE> from the specified bytes arra y. | |
46 | * @pa ram bytes The four b ytes compo sing the a ddress. | |
47 | * @ex ception Il legalArgum entExcepti on The len gth of the array is not equal to four. | |
48 | */ | |
49 | public SnmpIpAdd ress(byte[ ] bytes) t hrows Ille galArgumen tException { | |
50 | bu ildFromByt eArray(byt es); | |
51 | } | |
52 | ||
53 | /** | |
54 | * Con structs a new <CODE> SnmpIpAddr ess</CODE> from the specified long value . | |
55 | * @pa ram addr T he initial ization va lue. | |
56 | */ | |
57 | public SnmpIpAdd ress(long addr) { | |
58 | in t address = (int)add r ; | |
59 | by te[] ipadd r = new by te[4]; | |
60 | ||
61 | ip addr[0] = (byte) ((a ddress >>> 24) & 0xF F); | |
62 | ip addr[1] = (byte) ((a ddress >>> 16) & 0xF F); | |
63 | ip addr[2] = (byte) ((a ddress >>> 8) & 0xFF ); | |
64 | ip addr[3] = (byte) (ad dress & 0x FF); | |
65 | ||
66 | bu ildFromByt eArray(ipa ddr); | |
67 | } | |
68 | ||
69 | /** | |
70 | * Con structs a new <CODE> SnmpIpAddr ess</CODE> from a do t-formatte d <CODE>St ring</CODE >. | |
71 | * The dot-forma tted <CODE >String</C ODE> is fo rmulated x .x.x.x . | |
72 | * @pa ram dotAdd ress The i nitializat ion value. | |
73 | * @ex ception Il legalArgum entExcepti on The str ing does n ot corresp ond to an ip address . | |
74 | */ | |
75 | public SnmpIpAdd ress(Strin g dotAddre ss) throws IllegalAr gumentExce ption { | |
76 | su per(dotAdd ress) ; | |
77 | if ((compone ntCount > 4) || | |
78 | (compone nts[0] > 2 55) || | |
79 | (compone nts[1] > 2 55) || | |
80 | (compone nts[2] > 2 55) || | |
81 | (compone nts[3] > 2 55)) { | |
82 | throw ne w IllegalA rgumentExc eption(dot Address) ; | |
83 | } | |
84 | } | |
85 | ||
86 | /** | |
87 | * Con structs a new <CODE> SnmpIpAddr ess</CODE> from four long valu es. | |
88 | * @pa ram b1 Byt e 1. | |
89 | * @pa ram b2 Byt e 2. | |
90 | * @pa ram b3 Byt e 3. | |
91 | * @pa ram b4 Byt e 4. | |
92 | * @ex ception Il legalArgum entExcepti on A value is outsid e of [0-25 5]. | |
93 | */ | |
94 | public SnmpIpAdd ress(long b1, long b 2, long b3 , long b4) { | |
95 | su per(b1, b2 , b3, b4) ; | |
96 | if ((compone nts[0] > 2 55) || | |
97 | (compone nts[1] > 2 55) || | |
98 | (compone nts[2] > 2 55) || | |
99 | (compone nts[3] > 2 55)) { | |
100 | throw ne w IllegalA rgumentExc eption() ; | |
101 | } | |
102 | } | |
103 | ||
104 | // PUB LIC METHOD S | |
105 | //---- ---------- - | |
106 | /** | |
107 | * Con verts the address va lue to its byte arra y form. | |
108 | * @re turn The b yte array representa tion of th e value. | |
109 | */ | |
110 | public byte[] by teValue() { | |
111 | by te[] resul t = new by te[4] ; | |
112 | re sult[0] = (byte)comp onents[0] ; | |
113 | re sult[1] = (byte)comp onents[1] ; | |
114 | re sult[2] = (byte)comp onents[2] ; | |
115 | re sult[3] = (byte)comp onents[3] ; | |
116 | ||
117 | re turn resul t ; | |
118 | } | |
119 | ||
120 | /** | |
121 | * Con verts the address to its <CODE >String</C ODE> form. | |
122 | * Sam e as <CODE >toString( )</CODE>. Exists onl y to follo w a naming scheme. | |
123 | * @re turn The < CODE>Strin g</CODE> r epresentat ion of the value. | |
124 | */ | |
125 | public String st ringValue( ) { | |
126 | re turn toStr ing() ; | |
127 | } | |
128 | ||
129 | /** | |
130 | * Ext racts the ip address from an i ndex OID a nd returns its | |
131 | * val ue convert ed as an < CODE>SnmpO id</CODE>. | |
132 | * @pa ram index The index array. | |
133 | * @pa ram start The positi on in the index arra y. | |
134 | * @re turn The O ID represe nting the ip address value. | |
135 | * @ex ception Sn mpStatusEx ception Th ere is no ip address value | |
136 | * ava ilable at the start position. | |
137 | */ | |
138 | public static Sn mpOid toOi d(long[] i ndex, int start) thr ows SnmpSt atusExcept ion { | |
139 | if (start + 4 <= index .length) { | |
140 | try { | |
141 | retu rn new Snm pOid( | |
142 | index [start], | |
143 | index [start+1], | |
144 | index [start+2], | |
145 | index [start+3]) ; | |
146 | } | |
147 | catch(Il legalArgum entExcepti on e) { | |
148 | thro w new Snmp StatusExce ption(Snmp StatusExce ption.noSu chName) ; | |
149 | } | |
150 | } | |
151 | el se { | |
152 | throw ne w SnmpStat usExceptio n(SnmpStat usExceptio n.noSuchNa me) ; | |
153 | } | |
154 | } | |
155 | ||
156 | /** | |
157 | * Sca ns an inde x OID, ski ps the add ress value and retur ns the pos ition | |
158 | * of the next v alue. | |
159 | * @pa ram index The index array. | |
160 | * @pa ram start The positi on in the index arra y. | |
161 | * @re turn The p osition of the next value. | |
162 | * @ex ception Sn mpStatusEx ception Th ere is no address va lue | |
163 | * ava ilable at the start position. | |
164 | */ | |
165 | public static in t nextOid( long[] ind ex, int st art) throw s SnmpStat usExceptio n { | |
166 | if (start + 4 <= index .length) { | |
167 | return s tart + 4 ; | |
168 | } | |
169 | el se { | |
170 | throw ne w SnmpStat usExceptio n(SnmpStat usExceptio n.noSuchNa me) ; | |
171 | } | |
172 | } | |
173 | ||
174 | /** | |
175 | * App ends an <C ODE>SnmpOi d</CODE> r epresentin g an <CODE >SnmpIpAdd ress</CODE > to anoth er OID. | |
176 | * @pa ram source An OID re presenting an <CODE> SnmpIpAddr ess</CODE> value. | |
177 | * @pa ram dest W here sourc e should b e appended . | |
178 | */ | |
179 | public static vo id appendT oOid(SnmpO id source, SnmpOid d est) { | |
180 | if (source.g etLength() != 4) { | |
181 | throw ne w IllegalA rgumentExc eption() ; | |
182 | } | |
183 | de st.append( source) ; | |
184 | } | |
185 | ||
186 | /** | |
187 | * Ret urns a tex tual descr iption of the type o bject. | |
188 | * @re turn ASN.1 textual d escription . | |
189 | */ | |
190 | final public Str ing getTyp eName() { | |
191 | re turn name ; | |
192 | } | |
193 | ||
194 | // PRI D A N E S M T ODS | |
195 | //---- ---------- -- | |
196 | /** | |
197 | * Bui ld Ip addr ess from b yte array. | |
198 | */ | |
199 | privat e void bui ldFromByte Array(byte [] bytes) { | |
200 | if (bytes.le ngth != 4) { | |
201 | throw ne w IllegalA rgumentExc eption() ; | |
202 | } | |
203 | co mponents = new long[ 4] ; | |
204 | co mponentCou nt= 4; | |
205 | co mponents[0 ] = (bytes [0] >= 0) ? bytes[0] : bytes[0 ] + 256 ; | |
206 | co mponents[1 ] = (bytes [1] >= 0) ? bytes[1] : bytes[1 ] + 256 ; | |
207 | co mponents[2 ] = (bytes [2] >= 0) ? bytes[2] : bytes[2 ] + 256 ; | |
208 | co mponents[3 ] = (bytes [3] >= 0) ? bytes[3] : bytes[3 ] + 256 ; | |
209 | } | |
210 | ||
211 | // VAR IABLES | |
212 | //---- ------ | |
213 | /** | |
214 | * Nam e of the t ype. | |
215 | */ | |
216 | final static Str ing name = "IpAddres s" ; | |
217 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.