private static native int nativeRead(int fd, byte[] array, int numBytes);
private static native int nativePeek(int fd);
private static native void nativeClose(int fd);
+ private static native int nativeAvailable(int fd);
public int read() {
byte b[]=new byte[1];
public int peek() {
return nativePeek(fd);
}
+
+ public int read(byte[] b, int offset, int len) {
+ if (offset < 0 || len < 0 || offset + len > b.length){
+ return -1;
+ }
+ byte readbuf[]=new byte[len];
+ int rtr=nativeRead(fd, readbuf, len);
+ for(int i=offset;i<len+offset;i++){
+ b[i]=readbuf[i-offset];
+ }
+ return rtr;
+ }
public int read(byte[] b) {
return nativeRead(fd, b, b.length);
public void close() {
nativeClose(fd);
}
+
+ public int available(){
+ return nativeAvailable(fd);
+ }
}
#endif
}
#endif
+
+#ifdef D___FileInputStream______nativeAvailable____I
+int CALL11(___FileInputStream______nativeAvailable____I, int fd, int fd) {
+#ifdef MULTICORE
+ return 0;
+#else
+ int avail;
+ int cur=lseek(fd, 0, SEEK_CUR);
+ int fsize = lseek(fd, 0, SEEK_END);
+ avail=fsize-cur;
+ return avail;
+#endif
+}
+#endif