home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1998 January / PCO0198.ISO / 1&1 / java.z / java_301 / netscape / net / URLInputStream.class (.txt) < prev    next >
Encoding:
Java Class File  |  1996-10-20  |  889 b   |  29 lines

  1. package netscape.net;
  2.  
  3. import java.io.IOException;
  4. import java.io.InputStream;
  5.  
  6. public class URLInputStream extends InputStream {
  7.    protected URLConnection connection;
  8.  
  9.    public URLInputStream(URLConnection con) {
  10.       this.connection = con;
  11.    }
  12.  
  13.    protected native void open() throws IOException;
  14.  
  15.    public int read() throws IOException {
  16.       byte[] b = new byte[1];
  17.       int result = this.read(b, 0, 1);
  18.       return result == -1 ? result : b[0] & 255;
  19.    }
  20.  
  21.    public native int read(byte[] var1, int var2, int var3) throws IOException;
  22.  
  23.    public native int available() throws IOException;
  24.  
  25.    public void close() throws IOException {
  26.       this.connection.close();
  27.    }
  28. }
  29.