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