equal
deleted
inserted
replaced
88 ] |
88 ] |
89 ! ! |
89 ! ! |
90 |
90 |
91 !UUID class methodsFor:'instance creation'! |
91 !UUID class methodsFor:'instance creation'! |
92 |
92 |
|
93 basicNew |
|
94 ^ super basicNew:16 |
|
95 ! |
|
96 |
|
97 basicNew:size |
|
98 "allow creating with exact size. We need this for XMLStandardDecoder" |
|
99 |
|
100 size ~~ 16 ifTrue:[ |
|
101 ^ self shouldNotImplement. |
|
102 ]. |
|
103 ^ super basicNew:size. |
|
104 ! |
|
105 |
93 fromBytes:aByteArray |
106 fromBytes:aByteArray |
94 "set uuid from aByteArray. |
107 "set uuid from aByteArray. |
95 aByteArray must be 16 bytes in network byte order (MSB-first)" |
108 aByteArray must be 16 bytes in network byte order (MSB-first)" |
96 |
109 |
97 |uuid| |
110 |uuid| |
98 |
111 |
99 uuid := self new. |
112 uuid := super basicNew:16. |
100 uuid replaceFrom:1 to:16 with:aByteArray. |
113 uuid replaceFrom:1 to:16 with:aByteArray. |
101 ^ uuid. |
114 ^ uuid. |
102 |
115 |
103 " |
116 " |
104 UUID fromBytes:#[16r01 16r02 16r03 16r04 |
117 UUID fromBytes:#[16r01 16r02 16r03 16r04 |
159 ! |
172 ! |
160 |
173 |
161 genRandomUUID |
174 genRandomUUID |
162 "generate a new random UUID" |
175 "generate a new random UUID" |
163 |
176 |
164 ^ self new genRandomUUID |
177 ^ (super basicNew:16) genRandomUUID |
165 |
178 |
166 " |
179 " |
167 self genRandomUUID |
180 self genRandomUUID |
168 " |
181 " |
169 ! |
182 ! |
172 "generate a uuid. |
185 "generate a uuid. |
173 If a physical mac address can be retrieved from the OS, |
186 If a physical mac address can be retrieved from the OS, |
174 a mac-address/timestamp uuid is generated, |
187 a mac-address/timestamp uuid is generated, |
175 otherwise a random uuid will be generated." |
188 otherwise a random uuid will be generated." |
176 |
189 |
177 ^ self new genUUID |
190 ^ (super basicNew:16) genUUID |
178 |
191 |
179 " |
192 " |
180 self genUUID |
193 self genUUID |
181 " |
194 " |
182 ! |
195 ! |
183 |
196 |
184 new |
197 new |
185 ^ super new:16 |
198 ^ (super basicNew:16) genUUID |
|
199 |
|
200 " |
|
201 self new |
|
202 " |
186 ! |
203 ! |
187 |
204 |
188 new:size |
205 new:size |
189 "allow creating with exact size. We need this for XMLStandardDecoder" |
206 "allow creating with exact size. We need this for XMLStandardDecoder" |
190 |
207 |
199 |
216 |
200 Error handle:[:ex | |
217 Error handle:[:ex | |
201 ^ errorBlock value. |
218 ^ errorBlock value. |
202 ] do:[ |
219 ] do:[ |
203 s := aStringOrStream readStream. |
220 s := aStringOrStream readStream. |
204 uuid := self new. |
221 uuid := super basicNew:16. |
205 |
222 |
206 s skipSeparators. |
223 s skipSeparators. |
207 s peek == ${ ifTrue:[s next]. |
224 s peek == ${ ifTrue:[s next]. |
208 s skipSeparators. |
225 s skipSeparators. |
209 |
226 |
582 ! ! |
599 ! ! |
583 |
600 |
584 !UUID class methodsFor:'documentation'! |
601 !UUID class methodsFor:'documentation'! |
585 |
602 |
586 version |
603 version |
587 ^ '$Header: /cvs/stx/stx/libbasic2/UUID.st,v 1.23 2007-10-10 21:17:50 cg Exp $' |
604 ^ '$Header: /cvs/stx/stx/libbasic2/UUID.st,v 1.24 2008-01-21 12:43:07 cg Exp $' |
588 ! ! |
605 ! ! |
589 |
606 |
590 UUID initialize! |
607 UUID initialize! |