home *** CD-ROM | disk | FTP | other *** search
- package sun.net.www.protocol.doc;
-
- import java.io.BufferedInputStream;
- import java.io.File;
- import java.io.FileInputStream;
- import java.io.FilePermission;
- import java.io.IOException;
- import java.io.InputStream;
- import java.net.FileNameMap;
- import java.net.URL;
- import java.security.AccessController;
- import java.security.Permission;
- import sun.net.www.MessageHeader;
- import sun.net.www.URLConnection;
- import sun.security.action.GetPropertyAction;
-
- public class DocURLConnection extends URLConnection {
- // $FF: renamed from: is java.io.InputStream
- InputStream field_0;
- String filename;
- Permission permission;
- static String installDirectory = (String)AccessController.doPrivileged(new GetPropertyAction("hotjava.home"));
-
- DocURLConnection(URL var1) {
- super(var1);
- }
-
- public void connect() throws IOException {
- String var1 = installDirectory + super.url.getFile();
- MessageHeader var2 = new MessageHeader();
- FileNameMap var3 = java.net.URLConnection.getFileNameMap();
- String var4 = var3.getContentTypeFor(var1);
- if (var4 != null) {
- var2.add("content-type", var4);
- }
-
- ((URLConnection)this).setProperties(var2);
- File var5 = new File(var1);
- if (var5.exists()) {
- var2.add("Content-length", String.valueOf(var5.length()));
- }
-
- this.filename = var1.replace('/', File.separatorChar);
- this.field_0 = new BufferedInputStream(new FileInputStream(this.filename));
- super.connected = true;
- }
-
- public synchronized InputStream getInputStream() throws IOException {
- if (!super.connected) {
- this.connect();
- }
-
- return this.field_0;
- }
-
- public Permission getPermission() throws IOException {
- if (this.permission == null) {
- if (File.separatorChar == '/') {
- this.permission = new FilePermission(super.url.getFile(), "read");
- } else {
- this.permission = new FilePermission(super.url.getFile().replace('/', File.separatorChar), "read");
- }
- }
-
- return this.permission;
- }
-
- static {
- if (installDirectory == null) {
- installDirectory = "/usr/local/hotjava";
- }
-
- }
- }
-