JAL-1807 Bob's JalviewJS prototype first commit
[jalviewjs.git] / site / j2s / java / io / Writer.js
1 Clazz.load(["java.io.Closeable","$.Flushable","java.lang.Appendable"],"java.io.Writer",["java.lang.NullPointerException","$.StringIndexOutOfBoundsException"],function(){\r
2 c$=Clazz.decorateAsClass(function(){\r
3 this.lock=null;\r
4 Clazz.instantialize(this,arguments);\r
5 },java.io,"Writer",null,[Appendable,java.io.Closeable,java.io.Flushable]);\r
6 Clazz.makeConstructor(c$,\r
7 function(){\r
8 this.lock=this;\r
9 });\r
10 Clazz.makeConstructor(c$,\r
11 function(lock){\r
12 if(lock!=null){\r
13 this.lock=lock;\r
14 }else{\r
15 throw new NullPointerException();\r
16 }},"~O");\r
17 Clazz.defineMethod(c$,"write",\r
18 function(buf){\r
19 this.write(buf,0,buf.length);\r
20 },"~A");\r
21 Clazz.defineMethod(c$,"write",\r
22 function(oneChar){\r
23 {\r
24 var oneCharArray=Clazz.newArray(1,'\0');\r
25 oneCharArray[0]=String.fromCharCode(oneChar);\r
26 this.write(oneCharArray);\r
27 }},"~N");\r
28 Clazz.defineMethod(c$,"write",\r
29 function(str){\r
30 var buf=Clazz.newArray(str.length,'\0');\r
31 str.getChars(0,buf.length,buf,0);\r
32 {\r
33 this.write(buf);\r
34 }},"~S");\r
35 Clazz.defineMethod(c$,"write",\r
36 function(str,offset,count){\r
37 if(count>=0){\r
38 var buf=Clazz.newArray(count,'\0');\r
39 str.getChars(offset,offset+count,buf,0);\r
40 {\r
41 this.write(buf);\r
42 }}else{\r
43 throw new StringIndexOutOfBoundsException();\r
44 }},"~S,~N,~N");\r
45 Clazz.defineMethod(c$,"append",\r
46 function(c){\r
47 this.write(c.charCodeAt(0));\r
48 return this;\r
49 },"~N");\r
50 Clazz.defineMethod(c$,"append",\r
51 function(csq){\r
52 if(null==csq){\r
53 this.write("null");\r
54 }else{\r
55 this.write(csq.toString());\r
56 }return this;\r
57 },"CharSequence");\r
58 Clazz.defineMethod(c$,"append",\r
59 function(csq,start,end){\r
60 if(null==csq){\r
61 this.write("null".substring(start,end));\r
62 }else{\r
63 this.write(csq.subSequence(start,end).toString());\r
64 }return this;\r
65 },"CharSequence,~N,~N");\r
66 Clazz.defineStatics(c$,\r
67 "TOKEN_NULL","null");\r
68 });\r