checkin from browser
authorpenk
Wed, 11 Sep 2002 19:08:04 +0200
changeset 1611 5804b7d63ee8
parent 1610 34bb3a9f1379
child 1612 4c7893f943a8
checkin from browser
MIMETypes.st
--- a/MIMETypes.st	Wed Sep 11 17:42:31 2002 +0200
+++ b/MIMETypes.st	Wed Sep 11 19:08:04 2002 +0200
@@ -1,6 +1,6 @@
 "
  COPYRIGHT (c) 1997 by eXept Software AG 
-	      All Rights Reserved
+              All Rights Reserved
 
  This software is furnished under a license and may be used
  only in accordance with the terms of that license and with the
@@ -15,12 +15,12 @@
 "{ Package: 'stx:libview2' }"
 
 Object subclass:#MIMETypes
-	instanceVariableNames:''
-	classVariableNames:'TypeToImageReaderClassMapping FileSuffixToTypeMapping
-		FilenameToTypeMapping FileSuffixToImageReaderClassMapping
-		CharSetToFontMapping LastSuffix LastType'
-	poolDictionaries:''
-	category:'System-Documentation'
+        instanceVariableNames:''
+        classVariableNames:'TypeToImageReaderClassMapping FileSuffixToTypeMapping
+                FilenameToTypeMapping FileSuffixToImageReaderClassMapping
+                CharSetToFontMapping LastSuffix LastType'
+        poolDictionaries:''
+        category:'System-Documentation'
 !
 
 !MIMETypes class methodsFor:'documentation'!
@@ -28,7 +28,7 @@
 copyright
 "
  COPYRIGHT (c) 1997 by eXept Software AG 
-	      All Rights Reserved
+              All Rights Reserved
 
  This software is furnished under a license and may be used
  only in accordance with the terms of that license and with the
@@ -137,14 +137,13 @@
 applicationTypeList
     "applications"
 
-    |types|                              
+    |typeStrings|                            
 
-    types := OrderedCollection new.
-    types addAll:self applicationProgLangTypeList.
-    types addAll:self applicationTextTypeList.
-    types addAll:self applicationComprAndArchiveTypeList.
-    types addAll:self applicationMiscTypeList.
-    ^ types
+    typeStrings := OrderedCollection new.
+    typeStrings addAll:self applicationProgLangTypeList.
+    typeStrings addAll:self applicationTextTypeList.
+    typeStrings addAll:self applicationComprAndArchiveTypeList.
+    ^ typeStrings
 !
 
 audioTypeList
@@ -604,6 +603,16 @@
 
 !
 
+mimeTypeForFilenameByContents:filenameArg
+    "given a filename, return the mime-type or nil, if unknown"
+
+    |type filename|
+
+    filename := filenameArg asFilename.
+
+    ^ type
+!
+
 mimeTypeForSuffix:suffix
     "given a file suffix, return the mime-type"
 
@@ -651,11 +660,17 @@
 mimeTypeForSuffixMapping
 
     ^ FileSuffixToTypeMapping
+!
+
+mimeTypeOfContents:filename
+    "given a filename, scan the contents, return the mime-type or nil, if unknown"
+
+    ^ filename mimeTypeOfContents.
 ! !
 
 !MIMETypes class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/MIMETypes.st,v 1.40 2002-09-11 15:42:31 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/MIMETypes.st,v 1.41 2002-09-11 17:08:04 penk Exp $'
 ! !
 MIMETypes initialize!