home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 25 / CDROM25.iso / Share / prog / VJ11 / VJTRIAL.EXE / IE30Java.exe / classd.exe / sun / net / www / Win32MimeTable.java < prev   
Encoding:
Java Source  |  1997-01-27  |  3.2 KB  |  81 lines

  1. /*
  2.  * @(#)Win32MimeTable.java    1.6 95/08/22  
  3.  *
  4.  * Copyright (c) 1994 Sun Microsystems, Inc. All Rights Reserved.
  5.  *
  6.  * Permission to use, copy, modify, and distribute this software
  7.  * and its documentation for NON-COMMERCIAL purposes and without
  8.  * fee is hereby granted provided that this copyright notice
  9.  * appears in all copies. Please refer to the file "copyright.html"
  10.  * for further important copyright and licensing information.
  11.  *
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
  13.  * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
  14.  * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  15.  * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
  16.  * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
  17.  * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
  18.  */
  19.  
  20. package sun.net.www;
  21.  
  22. import java.io.*;
  23. import java.net.URL;
  24.  
  25. /** OS dependent class to find mime description files.
  26.   This is currently just a copy of the Solaris Mime table.
  27.   It needs to be modified to work under Windows. */
  28. class Win32MimeTable extends MimeTable {
  29.     Win32MimeTable() {
  30.     InputStream is = null;
  31.     String slist[] = {
  32.         System.getProperty("user.mailcap"),
  33.         System.getProperty("user.home") + "/.mailcap",
  34.         "/etc/mailcap",
  35.         "/usr/etc/mailcap",
  36.         "/usr/local/etc/mailcap",
  37.         System.getProperty("hotjava.home", "/usr/local/hotjava") + "/lib/mailcap"
  38.     };
  39.     for (int i = 0; i < slist.length; i++) {
  40.         if (slist[i] != null) {
  41.         try {
  42.             is = new FileInputStream(slist[i]);
  43.             break;
  44.         } catch(Exception e) {
  45.         }
  46.         }
  47.     }
  48.     if (is != null) {
  49.         ParseMailcap(is);
  50.         try {
  51.         is.close();
  52.         } catch(IOException e) {}
  53.     }
  54.     add(new MimeEntry ("application/postscript", "imagetool %s; rm %s"));
  55.     add(new MimeEntry ("application/x-dvi", "xdvi %s"));
  56.     add(new MimeEntry ("application/x-troff", "xterm -title troff -e sh -c \"nroff %s | col | more -w ; rm %s\""));
  57.     add(new MimeEntry ("application/x-troff-man", "xterm -title troff -e sh -c \"nroff -man %s | col | more -w ; rm %s\""));
  58.     add(new MimeEntry ("application/x-troff-me", "xterm -title troff -e sh -c \"nroff -me %s | col | more -w ; rm %s\""));
  59.     add(new MimeEntry ("application/x-troff-ms", "xterm -title troff -e sh -c \"nroff -ms %s | col | more -w ; rm %s\""));
  60.     add(new MimeEntry ("video/mpeg", "mpeg_play %s; rm %s"));
  61.     add(new MimeEntry ("application/x-tar", "loadtofile"));
  62.     add(new MimeEntry ("application/x-gtar", "loadtofile"));
  63.     add(new MimeEntry ("application/x-hdf", "loadtofile"));
  64.     add(new MimeEntry ("application/x-netcdf", "loadtofile"));
  65.     add(new MimeEntry ("application/x-shar", "loadtofile"));
  66.     add(new MimeEntry ("application/x-sv4cpio", "loadtofile"));
  67.     add(new MimeEntry ("application/x-sv4crc", "loadtofile"));
  68.     add(new MimeEntry ("application/zip", "loadtofile"));
  69.     add(new MimeEntry ("application/x-bcpio", "loadtofile"));
  70.     add(new MimeEntry ("application/x-cpio", "loadtofile"));
  71.     add(new MimeEntry ("application/octet-stream", "loadtofile"));
  72.     add(new MimeEntry ("application/x-ustar", "loadtofile"));
  73.     add(new MimeEntry ("audio/", "audiotool %s"));
  74.     add(new MimeEntry ("image/", "xv %s; rm %s"));
  75.     }
  76.  
  77.     String TempTemplate() {
  78.     return "/tmp/%s.wrt";
  79.     }
  80. }
  81.