1 Clazz.declarePackage ("java.util");
\r
2 Clazz.load (["java.util.Hashtable"], "java.util.Properties", ["java.lang.IllegalArgumentException"], function () {
\r
3 c$ = Clazz.decorateAsClass (function () {
\r
4 this.defaults = null;
\r
5 if (!Clazz.isClassDefined ("java.util.Properties.LineReader")) {
\r
6 java.util.Properties.$Properties$LineReader$ ();
\r
8 Clazz.instantialize (this, arguments);
\r
9 }, java.util, "Properties", java.util.Hashtable);
\r
10 Clazz.makeConstructor (c$,
\r
12 this.construct (null);
\r
14 Clazz.makeConstructor (c$,
\r
15 function (defaults) {
\r
16 Clazz.superConstructor (this, java.util.Properties, []);
\r
17 this.defaults = defaults;
\r
18 }, "java.util.Properties");
\r
19 Clazz.defineMethod (c$, "setProperty",
\r
20 function (key, value) {
\r
21 return this.put (key, value);
\r
23 Clazz.defineMethod (c$, "load",
\r
25 this.load0 (Clazz.innerTypeInstance (java.util.Properties.LineReader, this, null, reader));
\r
26 }, "java.io.Reader");
\r
27 Clazz.defineMethod (c$, "load",
\r
28 function (inStream) {
\r
29 this.load0 (Clazz.innerTypeInstance (java.util.Properties.LineReader, this, null, inStream));
\r
30 }, "java.io.InputStream");
\r
31 Clazz.defineMethod (c$, "load0",
\r
33 var convtBuf = Clazz.newCharArray (1024, '\0');
\r
39 var precedingBackslash;
\r
40 while ((limit = lr.readLine ()) >= 0) {
\r
41 c = String.fromCharCode ( 0);
\r
45 precedingBackslash = false;
\r
46 while (keyLen < limit) {
\r
47 c = lr.lineBuf[keyLen];
\r
48 if ((c == '=' || c == ':') && !precedingBackslash) {
\r
49 valueStart = keyLen + 1;
\r
52 } else if ((c == ' ' || c == '\t' || c == '\f') && !precedingBackslash) {
\r
53 valueStart = keyLen + 1;
\r
56 precedingBackslash = !precedingBackslash;
\r
58 precedingBackslash = false;
\r
61 while (valueStart < limit) {
\r
62 c = lr.lineBuf[valueStart];
\r
63 if (c != ' ' && c != '\t' && c != '\f') {
\r
64 if (!hasSep && (c == '=' || c == ':')) {
\r
70 var key = this.loadConvert (lr.lineBuf, 0, keyLen, convtBuf);
\r
71 var value = this.loadConvert (lr.lineBuf, valueStart, limit - valueStart, convtBuf);
\r
72 this.put (key, value);
\r
74 }, "java.util.Properties.LineReader");
\r
75 Clazz.defineMethod (c$, "loadConvert",
\r
76 function ($in, off, len, convtBuf) {
\r
77 if (convtBuf.length < len) {
\r
78 var newLen = len * 2;
\r
80 newLen = 2147483647;
\r
81 }convtBuf = Clazz.newCharArray (newLen, '\0');
\r
85 var end = off + len;
\r
88 if (aChar == '\\') {
\r
92 for (var i = 0; i < 4; i++) {
\r
105 value = (value << 4) + aChar.charCodeAt (0) - 48;
\r
113 value = (value << 4) + 10 + aChar.charCodeAt (0) - 97;
\r
121 value = (value << 4) + 10 + aChar.charCodeAt (0) - 65;
\r
124 throw new IllegalArgumentException ("Malformed \\uxxxx encoding.");
\r
127 out[outLen++] = String.fromCharCode (value);
\r
129 if (aChar == 't') aChar = '\t';
\r
130 else if (aChar == 'r') aChar = '\r';
\r
131 else if (aChar == 'n') aChar = '\n';
\r
132 else if (aChar == 'f') aChar = '\f';
\r
133 out[outLen++] = aChar;
\r
135 out[outLen++] = aChar;
\r
137 return String.instantialize (out, 0, outLen);
\r
139 Clazz.defineMethod (c$, "getProperty",
\r
141 var oval = Clazz.superCall (this, java.util.Properties, "get", [key]);
\r
142 var sval = (Clazz.instanceOf (oval, String)) ? oval : null;
\r
143 return ((sval == null) && (this.defaults != null)) ? this.defaults.getProperty (key) : sval;
\r
145 Clazz.defineMethod (c$, "getProperty",
\r
146 function (key, defaultValue) {
\r
147 var val = this.getProperty (key);
\r
148 return (val == null) ? defaultValue : val;
\r
150 Clazz.defineMethod (c$, "propertyNames",
\r
152 var h = new java.util.Hashtable ();
\r
153 this.enumerate (h);
\r
156 Clazz.defineMethod (c$, "stringPropertyNames",
\r
158 var h = new java.util.Hashtable ();
\r
159 this.enumerateStringProperties (h);
\r
160 return h.keySet ();
\r
162 Clazz.defineMethod (c$, "enumerate",
\r
164 if (this.defaults != null) {
\r
165 this.defaults.enumerate (h);
\r
166 }for (var e = this.keys (); e.hasMoreElements (); ) {
\r
167 var key = e.nextElement ();
\r
168 h.put (key, this.get (key));
\r
170 }, "java.util.Hashtable");
\r
171 Clazz.defineMethod (c$, "enumerateStringProperties",
\r
173 if (this.defaults != null) {
\r
174 this.defaults.enumerateStringProperties (h);
\r
175 }for (var e = this.keys (); e.hasMoreElements (); ) {
\r
176 var k = e.nextElement ();
\r
177 var v = this.get (k);
\r
178 if (Clazz.instanceOf (k, String) && Clazz.instanceOf (v, String)) {
\r
181 }, "java.util.Hashtable");
\r
182 c$.$Properties$LineReader$ = function () {
\r
183 Clazz.pu$h(self.c$);
\r
184 c$ = Clazz.decorateAsClass (function () {
\r
185 Clazz.prepareCallback (this, arguments);
\r
186 this.inByteBuf = null;
\r
187 this.inCharBuf = null;
\r
188 this.lineBuf = null;
\r
191 this.inStream = null;
\r
192 this.reader = null;
\r
193 Clazz.instantialize (this, arguments);
\r
194 }, java.util.Properties, "LineReader");
\r
195 Clazz.prepareFields (c$, function () {
\r
196 this.lineBuf = Clazz.newCharArray (1024, '\0');
\r
198 Clazz.makeConstructor (c$,
\r
201 this.inByteBuf = Clazz.newByteArray (8192, 0);
\r
202 }, "java.io.InputStream");
\r
203 Clazz.makeConstructor (c$,
\r
206 this.inCharBuf = Clazz.newCharArray (8192, '\0');
\r
207 }, "java.io.Reader");
\r
208 Clazz.defineMethod (c$, "readLine",
\r
211 var b = String.fromCharCode (0);
\r
219 if (this.inOff >= this.inLimit) {
\r
220 this.inLimit = (this.inStream == null) ? this.reader.read (this.inCharBuf) : this.inStream.read (this.inByteBuf);
\r
222 if (this.inLimit <= 0) {
\r
226 }}if (this.inStream != null) {
\r
227 b = String.fromCharCode (0xff & this.inByteBuf[this.inOff++]);
\r
229 b = this.inCharBuf[this.inOff++];
\r
235 if (b == ' ' || b == '\t' || b == '\f') {
\r
237 }if (!f && (b == '\r' || b == '\n')) {
\r
243 if (b == '#' || b == '!') {
\r
246 }}if (b != '\n' && b != '\r') {
\r
247 this.lineBuf[a++] = b;
\r
248 if (a == this.lineBuf.length) {
\r
249 var i = this.lineBuf.length * 2;
\r
251 }var j = Clazz.newCharArray (i, '\0');
\r
252 System.arraycopy (this.lineBuf, 0, j, 0, this.lineBuf.length);
\r
265 }if (this.inOff >= this.inLimit) {
\r
266 this.inLimit = (this.inStream == null) ? this.reader.read (this.inCharBuf) : this.inStream.read (this.inByteBuf);
\r
268 if (this.inLimit <= 0) {
\r