Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / java / io / FileInputStream.js
1 Clazz.load(["java.io.Closeable","$.InputStream"],"java.io.FileInputStream",["java.lang.IndexOutOfBoundsException","$.NullPointerException"],function(){
2 c$=Clazz.decorateAsClass(function(){
3 this.fd=null;
4 this.innerFD=false;
5 Clazz.instantialize(this,arguments);
6 },java.io,"FileInputStream",java.io.InputStream,java.io.Closeable);
7 Clazz.makeConstructor(c$,
8 function(file){
9 Clazz.superConstructor(this,java.io.FileInputStream);
10 },"java.io.File");
11 Clazz.makeConstructor(c$,
12 function(fd){
13 Clazz.superConstructor(this,java.io.FileInputStream);
14 if(fd==null){
15 throw new NullPointerException();
16 }},"java.io.FileDescriptor");
17 Clazz.makeConstructor(c$,
18 function(fileName){
19 this.construct(null==fileName?null:null);
20 },"~S");
21 Clazz.overrideMethod(c$,"available",
22 function(){
23 return 0;
24 });
25 Clazz.overrideMethod(c$,"close",
26 function(){
27 if(this.fd==null){
28 return;
29 }});
30 Clazz.overrideMethod(c$,"finalize",
31 function(){
32 this.close();
33 });
34 Clazz.defineMethod(c$,"getFD",
35 function(){
36 return this.fd;
37 });
38 Clazz.defineMethod(c$,"read",
39 function(){
40 var readed=Clazz.newArray(1,0);
41 var result=this.read(readed,0,1);
42 return result==-1?-1:readed[0]&0xff;
43 });
44 Clazz.defineMethod(c$,"read",
45 function(buffer){
46 return this.read(buffer,0,buffer.length);
47 },"~A");
48 Clazz.defineMethod(c$,"read",
49 function(buffer,offset,count){
50 if(count>buffer.length-offset||count<0||offset<0){
51 throw new IndexOutOfBoundsException();
52 }if(0==count){
53 return 0;
54 }return 0;
55 },"~A,~N,~N");
56 Clazz.overrideMethod(c$,"skip",
57 function(count){
58 return 0;
59 },"~N");
60 });