X-Git-Url: http://source.jalview.org/gitweb/?p=jalviewjs.git;a=blobdiff_plain;f=site%2Fswingjs%2Fj2s%2Fjava%2Fio%2FBufferedOutputStream.js;fp=site%2Fswingjs%2Fj2s%2Fjava%2Fio%2FBufferedOutputStream.js;h=fe30a38192d3aece55544b5011026d882053db73;hp=5bf0d3f0ab1555eca23fbabf82b06a4c1ff7c76c;hb=b9b7a352eee79b7764c3b09c9d19663075061d8c;hpb=7301a2415adab88038b291fc54caeeb3a5a47a44 diff --git a/site/swingjs/j2s/java/io/BufferedOutputStream.js b/site/swingjs/j2s/java/io/BufferedOutputStream.js index 5bf0d3f..fe30a38 100644 --- a/site/swingjs/j2s/java/io/BufferedOutputStream.js +++ b/site/swingjs/j2s/java/io/BufferedOutputStream.js @@ -1,60 +1,60 @@ -Clazz.load(["java.io.FilterOutputStream"],"java.io.BufferedOutputStream",["java.lang.ArrayIndexOutOfBoundsException","$.IllegalArgumentException","$.NullPointerException"],function(){ -c$=Clazz.decorateAsClass(function(){ -this.buf=null; -this.count=0; -Clazz.instantialize(this,arguments); -},java.io,"BufferedOutputStream",java.io.FilterOutputStream); -Clazz.makeConstructor(c$, -function(out){ -Clazz.superConstructor(this,java.io.BufferedOutputStream,[out]); -this.buf=Clazz.newArray(8192,0); -},"java.io.OutputStream"); -Clazz.makeConstructor(c$, -function(out,size){ -Clazz.superConstructor(this,java.io.BufferedOutputStream,[out]); -if(size<=0){ -throw new IllegalArgumentException(("K0058")); -}this.buf=Clazz.newArray(size,0); -},"java.io.OutputStream,~N"); -Clazz.overrideMethod(c$,"flush", -function(){ -if(this.count>0){ -this.out.write(this.buf,0,this.count); -}this.count=0; -this.out.flush(); -}); -Clazz.defineMethod(c$,"write", -function(buffer,offset,length){ -if(buffer==null){ -throw new NullPointerException(("K0047")); -}if(offset<0||offset>buffer.length-length||length<0){ -throw new ArrayIndexOutOfBoundsException(("K002f")); -}if(this.count==0&&length>=this.buf.length){ -this.out.write(buffer,offset,length); -return; -}var available=this.buf.length-this.count; -if(length0){ -System.arraycopy(buffer,offset,this.buf,this.count,available); -this.count+=available; -}if(this.count==this.buf.length){ -this.out.write(this.buf,0,this.buf.length); -this.count=0; -if(length>available){ -offset+=available; -available=length-available; -if(available>=this.buf.length){ -this.out.write(buffer,offset,available); -}else{ -System.arraycopy(buffer,offset,this.buf,this.count,available); -this.count+=available; -}}}},"~A,~N,~N"); -Clazz.defineMethod(c$,"write", -function(oneByte){ -if(this.count==this.buf.length){ -this.out.write(this.buf,0,this.count); -this.count=0; -}this.buf[this.count++]=oneByte; -},"~N"); -}); +Clazz.load(["java.io.FilterOutputStream"],"java.io.BufferedOutputStream",["java.lang.ArrayIndexOutOfBoundsException","$.IllegalArgumentException","$.NullPointerException"],function(){ +c$=Clazz.decorateAsClass(function(){ +this.buf=null; +this.count=0; +Clazz.instantialize(this,arguments); +},java.io,"BufferedOutputStream",java.io.FilterOutputStream); +Clazz.makeConstructor(c$, +function(out){ +Clazz.superConstructor(this,java.io.BufferedOutputStream,[out]); +this.buf=Clazz.newArray(8192,0); +},"java.io.OutputStream"); +Clazz.makeConstructor(c$, +function(out,size){ +Clazz.superConstructor(this,java.io.BufferedOutputStream,[out]); +if(size<=0){ +throw new IllegalArgumentException(("K0058")); +}this.buf=Clazz.newArray(size,0); +},"java.io.OutputStream,~N"); +Clazz.overrideMethod(c$,"flush", +function(){ +if(this.count>0){ +this.out.write(this.buf,0,this.count); +}this.count=0; +this.out.flush(); +}); +Clazz.defineMethod(c$,"write", +function(buffer,offset,length){ +if(buffer==null){ +throw new NullPointerException(("K0047")); +}if(offset<0||offset>buffer.length-length||length<0){ +throw new ArrayIndexOutOfBoundsException(("K002f")); +}if(this.count==0&&length>=this.buf.length){ +this.out.write(buffer,offset,length); +return; +}var available=this.buf.length-this.count; +if(length0){ +System.arraycopy(buffer,offset,this.buf,this.count,available); +this.count+=available; +}if(this.count==this.buf.length){ +this.out.write(this.buf,0,this.buf.length); +this.count=0; +if(length>available){ +offset+=available; +available=length-available; +if(available>=this.buf.length){ +this.out.write(buffer,offset,available); +}else{ +System.arraycopy(buffer,offset,this.buf,this.count,available); +this.count+=available; +}}}},"~A,~N,~N"); +Clazz.defineMethod(c$,"write", +function(oneByte){ +if(this.count==this.buf.length){ +this.out.write(this.buf,0,this.count); +this.count=0; +}this.buf[this.count++]=oneByte; +},"~N"); +});