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

  1. /*
  2.  * @(#)SolarisMimeTable.java    1.10 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.net.URL;
  23. import java.io.*;
  24.  
  25. /** OS dependent class to find mime description files */
  26. class SolarisMimeTable extends MimeTable {
  27.     SolarisMimeTable() {
  28.     InputStream is = null;
  29.     String slist[] = {
  30.         System.getProperty("user.mailcap"),
  31.         System.getProperty("user.home") + "/.mailcap",
  32.         "/etc/mailcap",
  33.         "/usr/etc/mailcap",
  34.         "/usr/local/etc/mailcap",
  35.         System.getProperty("hotjava.home", "/usr/local/hotjava") + "/lib/mailcap"
  36.     };
  37.     for (int i = 0; i < slist.length; i++) {
  38.         if (slist[i] != null) {
  39.         try {
  40.             is = new FileInputStream(slist[i]);
  41.             break;
  42.         } catch(Exception e) {
  43.         }
  44.         }
  45.     }
  46.     if (is != null) {
  47.         try {
  48.         ParseMailcap(is);
  49.         is.close();
  50.         } catch(IOException e) {}
  51.     }
  52.     add(new MimeEntry ("application/postscript", "imagetool %s; rm %s"));
  53.     add(new MimeEntry ("application/x-dvi", "xdvi %s"));
  54.     add(new MimeEntry ("application/x-troff", "xterm -title troff -e sh -c \"nroff %s | col | more -w ; rm %s\""));
  55.     add(new MimeEntry ("application/x-troff-man", "xterm -title troff -e sh -c \"nroff -man %s | col | more -w ; rm %s\""));
  56.     add(new MimeEntry ("application/x-troff-me", "xterm -title troff -e sh -c \"nroff -me %s | col | more -w ; rm %s\""));
  57.     add(new MimeEntry ("application/x-troff-ms", "xterm -title troff -e sh -c \"nroff -ms %s | col | more -w ; rm %s\""));
  58.     add(new MimeEntry ("video/mpeg", "mpeg_play %s; rm %s"));
  59.     add(new MimeEntry ("application/x-tar", "loadtofile"));
  60.     add(new MimeEntry ("application/x-gtar", "loadtofile"));
  61.     add(new MimeEntry ("application/x-hdf", "loadtofile"));
  62.     add(new MimeEntry ("application/x-netcdf", "loadtofile"));
  63.     add(new MimeEntry ("application/x-shar", "loadtofile"));
  64.     add(new MimeEntry ("application/x-sv4cpio", "loadtofile"));
  65.     add(new MimeEntry ("application/x-sv4crc", "loadtofile"));
  66.     add(new MimeEntry ("application/zip", "loadtofile"));
  67.     add(new MimeEntry ("application/x-bcpio", "loadtofile"));
  68.     add(new MimeEntry ("application/x-cpio", "loadtofile"));
  69.     add(new MimeEntry ("application/octet-stream", "loadtofile"));
  70.     add(new MimeEntry ("application/x-ustar", "loadtofile"));
  71.     add(new MimeEntry ("audio/", "audiotool %s"));
  72.     add(new MimeEntry ("image/", "xv %s; rm %s"));
  73.     }
  74.  
  75.     String TempTemplate() {
  76.     return "/tmp/%s.wrt";
  77.     }
  78. }
  79.