home *** CD-ROM | disk | FTP | other *** search
- package java.net;
-
- import java.io.FileInputStream;
- import java.io.IOException;
-
- class SocketInputStream extends FileInputStream {
- private boolean eof;
- private SocketImpl impl;
- private byte[] temp = new byte[1];
-
- SocketInputStream(SocketImpl var1) throws IOException {
- super(var1.getFileDescriptor());
- this.impl = var1;
- }
-
- private native int socketRead(byte[] var1, int var2, int var3) throws IOException;
-
- public int read(byte[] var1) throws IOException {
- return this.read(var1, 0, var1.length);
- }
-
- public int read(byte[] var1, int var2, int var3) throws IOException {
- if (this.eof) {
- return -1;
- } else {
- int var4 = this.socketRead(var1, var2, var3);
- if (var4 <= 0) {
- this.eof = true;
- return -1;
- } else {
- return var4;
- }
- }
- }
-
- public int read() throws IOException {
- if (this.eof) {
- return -1;
- } else {
- int var1 = this.read(this.temp, 0, 1);
- return var1 <= 0 ? -1 : this.temp[0] & 255;
- }
- }
-
- public long skip(long var1) throws IOException {
- if (var1 <= 0L) {
- return 0L;
- } else {
- long var3 = var1;
- int var5 = (int)Math.min(1024L, var1);
-
- int var7;
- for(byte[] var6 = new byte[var5]; var3 > 0L; var3 -= (long)var7) {
- var7 = this.read(var6, 0, (int)Math.min((long)var5, var3));
- if (var7 < 0) {
- break;
- }
- }
-
- return var1 - var3;
- }
- }
-
- public int available() throws IOException {
- return this.impl.available();
- }
-
- public void close() throws IOException {
- this.impl.close();
- }
-
- protected void finalize() {
- }
- }
-