home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 June / CHIPHEFT062001.ISO / browser / nc32lyc / comm.z / java40.jar / netscape / net / URLInputStream.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-08-15  |  1.1 KB  |  36 lines

  1. package netscape.net;
  2.  
  3. import java.io.IOException;
  4. import java.io.InputStream;
  5.  
  6. final class URLInputStream extends InputStream {
  7.    final URLConnection connection;
  8.    private byte[] temp = new byte[1];
  9.  
  10.    public URLInputStream(URLConnection var1) {
  11.       System.getSecurityManager().checkURLConnect(((java.net.URLConnection)var1).getURL());
  12.       this.connection = var1;
  13.    }
  14.  
  15.    protected native void open() throws IOException;
  16.  
  17.    public int read() throws IOException {
  18.       int var1 = this.read(this.temp, 0, 1);
  19.       return var1 <= 0 ? -1 : this.temp[0] & 255;
  20.    }
  21.  
  22.    public int read(byte[] var1, int var2, int var3) throws IOException {
  23.       return this.read0(var1, var2, var3);
  24.    }
  25.  
  26.    native int read0(byte[] var1, int var2, int var3) throws IOException;
  27.  
  28.    public native long skip(long var1) throws IOException;
  29.  
  30.    public native int available() throws IOException;
  31.  
  32.    public void close() throws IOException {
  33.       this.connection.close();
  34.    }
  35. }
  36.