1 Clazz.load (["java.lang.Comparable", "$.Number"], "java.lang.Byte", null, function () {
\r
2 java.lang.Byte = Byte = function () {
\r
3 Clazz.instantialize (this, arguments);
\r
5 Clazz.decorateAsType (Byte, "Byte", Number, Comparable, null, true);
\r
6 Byte.prototype.valueOf = function () { return 0; };
\r
7 Byte.toString = Byte.prototype.toString = function () {
\r
8 if (arguments.length != 0) {
\r
9 return "" + arguments[0];
\r
10 } else if (this === Byte) {
\r
11 return "class java.lang.Byte"; // Byte.class.toString
\r
13 return "" + this.valueOf ();
\r
15 Clazz.makeConstructor (Byte,
\r
17 this.valueOf = function () {
\r
21 Clazz.makeConstructor (Byte,
\r
23 var v = Math.round (value) & 0xffffffff;
\r
24 this.valueOf = function () {
\r
28 Clazz.makeConstructor (Byte,
\r
30 var value = Byte.parseByte (s, 10);
\r
31 this.valueOf = function () {
\r
35 Byte.serialVersionUID = Byte.prototype.serialVersionUID = -7183698231559129828;
\r
36 Byte.MIN_VALUE = Byte.prototype.MIN_VALUE = -128;
\r
37 Byte.MAX_VALUE = Byte.prototype.MAX_VALUE = 127;
\r
38 Byte.SIZE = Byte.prototype.SIZE = 8;
\r
39 Byte.TYPE = Byte.prototype.TYPE = Byte;
\r
41 Clazz.defineMethod (Byte, "parseByte",
\r
42 function (s, radix) {
\r
44 throw new NumberFormatException ("null");
\r
46 throw new NumberFormatException ("radix " + radix + " less than Character.MIN_RADIX");
\r
48 throw new NumberFormatException ("radix " + radix + " greater than Character.MAX_RADIX");
\r
50 var integer = parseInt (s, radix);
52 throw new NumberFormatException ("Not a Number : " + s);
55 }, "String, Number");
\r
56 Byte.parseByte = Byte.prototype.parseByte;
\r
57 Clazz.defineMethod (Byte, "parseByte",
\r
59 return Byte.parseByte (s, 10);
\r
62 Byte.parseByte = Byte.prototype.parseByte;
\r
64 Clazz.defineMethod (Byte, "$valueOf",
\r
66 return new Byte(Byte.parseByte (s, 10));
\r
69 Clazz.defineMethod (Byte, "$valueOf",
\r
74 Clazz.defineMethod (Byte, "$valueOf",
\r
76 return new Byte(Byte.parseByte (s, r));
\r
79 Byte.$valueOf = Byte.prototype.$valueOf;
80 Clazz.overrideMethod(Byte, "equals",
\r
82 if(s == null || !Clazz.instanceOf(s, Byte) ){
85 return s.valueOf() == this.valueOf();
\r
87 Byte.toHexString = Byte.prototype.toHexString = function (i) {
\r
88 return i.toString (16);
\r
90 Byte.toOctalString = Byte.prototype.toOctalString = function (i) {
\r
91 return i.toString (8);
\r
93 Byte.toBinaryString = Byte.prototype.toBinaryString = function (i) {
\r
94 return i.toString (2);
\r
96 Byte.decode = Clazz.defineMethod (Byte, "decode",
\r
100 var negative = false;
\r
102 if (nm.startsWith ("-")) {
\r
105 }if (nm.startsWith ("0x", index) || nm.startsWith ("0X", index)) {
\r
108 } else if (nm.startsWith ("#", index)) {
\r
111 } else if (nm.startsWith ("0", index) && nm.length > 1 + index) {
\r
114 }if (nm.startsWith ("-", index)) throw new NumberFormatException ("Negative sign in wrong position");
\r
116 result = Byte.$valueOf (nm.substring (index), radix);
\r
117 result = negative ? new Byte (-result.byteValue ()) : result;
\r
119 if (Clazz.instanceOf (e, NumberFormatException)) {
\r
120 var constant = negative ? String.instantialize ("-" + nm.substring (index)) : nm.substring (index);
\r
121 result = Byte.$valueOf (constant, radix);
\r