File size: 1,985 Bytes
233f6d4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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(length<available){
available=length;
}if(available>0){
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");
});