Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / java / io / BufferedWriter.js
index afe4797..6e42d9a 100644 (file)
-Clazz.load(["java.io.Writer"],"java.io.BufferedWriter",["java.io.IOException","java.lang.IllegalArgumentException","$.IndexOutOfBoundsException","$.StringIndexOutOfBoundsException"],function(){\r
-c$=Clazz.decorateAsClass(function(){\r
-this.out=null;\r
-this.buf=null;\r
-this.pos=0;\r
-this.lineSeparator="\r\n";\r
-Clazz.instantialize(this,arguments);\r
-},java.io,"BufferedWriter",java.io.Writer);\r
-Clazz.makeConstructor(c$,\r
-function(out){\r
-Clazz.superConstructor(this,java.io.BufferedWriter,[out]);\r
-this.out=out;\r
-this.buf=Clazz.newArray(8192,'\0');\r
-},"java.io.Writer");\r
-Clazz.makeConstructor(c$,\r
-function(out,size){\r
-Clazz.superConstructor(this,java.io.BufferedWriter,[out]);\r
-if(size>0){\r
-this.out=out;\r
-this.buf=Clazz.newArray(size,'\0');\r
-}else{\r
-throw new IllegalArgumentException(("K0058"));\r
-}},"java.io.Writer,~N");\r
-Clazz.defineMethod(c$,"close",\r
-function(){\r
-{\r
-if(this.isOpen()){\r
-this.flush();\r
-this.out.close();\r
-this.buf=null;\r
-this.out=null;\r
-}}});\r
-Clazz.defineMethod(c$,"flush",\r
-function(){\r
-{\r
-if(this.isOpen()){\r
-if(this.pos>0){\r
-this.out.write(this.buf,0,this.pos);\r
-}this.pos=0;\r
-this.out.flush();\r
-}else{\r
-throw new java.io.IOException(("K005d"));\r
-}}});\r
-Clazz.defineMethod(c$,"isOpen",\r
-($fz=function(){\r
-return this.out!=null;\r
-},$fz.isPrivate=true,$fz));\r
-Clazz.defineMethod(c$,"newLine",\r
-function(){\r
-this.write("\r\n",0,"\r\n".length);\r
-});\r
-Clazz.defineMethod(c$,"write",\r
-function(cbuf,offset,count){\r
-{\r
-if(!this.isOpen()){\r
-throw new java.io.IOException(("K005d"));\r
-}if(offset<0||offset>cbuf.length-count||count<0){\r
-throw new IndexOutOfBoundsException();\r
-}if(this.pos==0&&count>=this.buf.length){\r
-this.out.write(cbuf,offset,count);\r
-return;\r
-}var available=this.buf.length-this.pos;\r
-if(count<available){\r
-available=count;\r
-}if(available>0){\r
-System.arraycopy(cbuf,offset,this.buf,this.pos,available);\r
-this.pos+=available;\r
-}if(this.pos==this.buf.length){\r
-this.out.write(this.buf,0,this.buf.length);\r
-this.pos=0;\r
-if(count>available){\r
-offset+=available;\r
-available=count-available;\r
-if(available>=this.buf.length){\r
-this.out.write(cbuf,offset,available);\r
-return;\r
-}System.arraycopy(cbuf,offset,this.buf,this.pos,available);\r
-this.pos+=available;\r
-}}}},"~A,~N,~N");\r
-Clazz.defineMethod(c$,"write",\r
-function(oneChar){\r
-{\r
-if(this.isOpen()){\r
-if(this.pos>=this.buf.length){\r
-this.out.write(this.buf,0,this.buf.length);\r
-this.pos=0;\r
-}this.buf[this.pos++]=String.fromCharCode(oneChar);\r
-}else{\r
-throw new java.io.IOException(("K005d"));\r
-}}},"~N");\r
-Clazz.defineMethod(c$,"write",\r
-function(str,offset,count){\r
-{\r
-if(!this.isOpen()){\r
-throw new java.io.IOException(("K005d"));\r
-}if(count<=0){\r
-return;\r
-}if(offset>str.length-count||offset<0){\r
-throw new StringIndexOutOfBoundsException();\r
-}if(this.pos==0&&count>=this.buf.length){\r
-var chars=Clazz.newArray(count,'\0');\r
-str.getChars(offset,offset+count,chars,0);\r
-this.out.write(chars,0,count);\r
-return;\r
-}var available=this.buf.length-this.pos;\r
-if(count<available){\r
-available=count;\r
-}if(available>0){\r
-str.getChars(offset,offset+available,this.buf,this.pos);\r
-this.pos+=available;\r
-}if(this.pos==this.buf.length){\r
-this.out.write(this.buf,0,this.buf.length);\r
-this.pos=0;\r
-if(count>available){\r
-offset+=available;\r
-available=count-available;\r
-if(available>=this.buf.length){\r
-var chars=Clazz.newArray(count,'\0');\r
-str.getChars(offset,offset+available,chars,0);\r
-this.out.write(chars,0,available);\r
-return;\r
-}str.getChars(offset,offset+available,this.buf,this.pos);\r
-this.pos+=available;\r
-}}}},"~S,~N,~N");\r
-});\r
+Clazz.load(["java.io.Writer"],"java.io.BufferedWriter",["java.io.IOException","java.lang.IllegalArgumentException","$.IndexOutOfBoundsException","$.StringIndexOutOfBoundsException"],function(){
+c$=Clazz.decorateAsClass(function(){
+this.out=null;
+this.buf=null;
+this.pos=0;
+this.lineSeparator="\r\n";
+Clazz.instantialize(this,arguments);
+},java.io,"BufferedWriter",java.io.Writer);
+Clazz.makeConstructor(c$,
+function(out){
+Clazz.superConstructor(this,java.io.BufferedWriter,[out]);
+this.out=out;
+this.buf=Clazz.newArray(8192,'\0');
+},"java.io.Writer");
+Clazz.makeConstructor(c$,
+function(out,size){
+Clazz.superConstructor(this,java.io.BufferedWriter,[out]);
+if(size>0){
+this.out=out;
+this.buf=Clazz.newArray(size,'\0');
+}else{
+throw new IllegalArgumentException(("K0058"));
+}},"java.io.Writer,~N");
+Clazz.defineMethod(c$,"close",
+function(){
+{
+if(this.isOpen()){
+this.flush();
+this.out.close();
+this.buf=null;
+this.out=null;
+}}});
+Clazz.defineMethod(c$,"flush",
+function(){
+{
+if(this.isOpen()){
+if(this.pos>0){
+this.out.write(this.buf,0,this.pos);
+}this.pos=0;
+this.out.flush();
+}else{
+throw new java.io.IOException(("K005d"));
+}}});
+Clazz.defineMethod(c$,"isOpen",
+($fz=function(){
+return this.out!=null;
+},$fz.isPrivate=true,$fz));
+Clazz.defineMethod(c$,"newLine",
+function(){
+this.write("\r\n",0,"\r\n".length);
+});
+Clazz.defineMethod(c$,"write",
+function(cbuf,offset,count){
+{
+if(!this.isOpen()){
+throw new java.io.IOException(("K005d"));
+}if(offset<0||offset>cbuf.length-count||count<0){
+throw new IndexOutOfBoundsException();
+}if(this.pos==0&&count>=this.buf.length){
+this.out.write(cbuf,offset,count);
+return;
+}var available=this.buf.length-this.pos;
+if(count<available){
+available=count;
+}if(available>0){
+System.arraycopy(cbuf,offset,this.buf,this.pos,available);
+this.pos+=available;
+}if(this.pos==this.buf.length){
+this.out.write(this.buf,0,this.buf.length);
+this.pos=0;
+if(count>available){
+offset+=available;
+available=count-available;
+if(available>=this.buf.length){
+this.out.write(cbuf,offset,available);
+return;
+}System.arraycopy(cbuf,offset,this.buf,this.pos,available);
+this.pos+=available;
+}}}},"~A,~N,~N");
+Clazz.defineMethod(c$,"write",
+function(oneChar){
+{
+if(this.isOpen()){
+if(this.pos>=this.buf.length){
+this.out.write(this.buf,0,this.buf.length);
+this.pos=0;
+}this.buf[this.pos++]=String.fromCharCode(oneChar);
+}else{
+throw new java.io.IOException(("K005d"));
+}}},"~N");
+Clazz.defineMethod(c$,"write",
+function(str,offset,count){
+{
+if(!this.isOpen()){
+throw new java.io.IOException(("K005d"));
+}if(count<=0){
+return;
+}if(offset>str.length-count||offset<0){
+throw new StringIndexOutOfBoundsException();
+}if(this.pos==0&&count>=this.buf.length){
+var chars=Clazz.newArray(count,'\0');
+str.getChars(offset,offset+count,chars,0);
+this.out.write(chars,0,count);
+return;
+}var available=this.buf.length-this.pos;
+if(count<available){
+available=count;
+}if(available>0){
+str.getChars(offset,offset+available,this.buf,this.pos);
+this.pos+=available;
+}if(this.pos==this.buf.length){
+this.out.write(this.buf,0,this.buf.length);
+this.pos=0;
+if(count>available){
+offset+=available;
+available=count-available;
+if(available>=this.buf.length){
+var chars=Clazz.newArray(count,'\0');
+str.getChars(offset,offset+available,chars,0);
+this.out.write(chars,0,available);
+return;
+}str.getChars(offset,offset+available,this.buf,this.pos);
+this.pos+=available;
+}}}},"~S,~N,~N");
+});