# HG changeset patch # User penk # Date 1031764084 -7200 # Node ID 5804b7d63ee8b352254b5f8fa562083ce613b2fc # Parent 34bb3a9f137965a2e810f7b214821ab6aaf8442c checkin from browser diff -r 34bb3a9f1379 -r 5804b7d63ee8 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!