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