MIMETypes.st
changeset 1611 5804b7d63ee8
parent 1610 34bb3a9f1379
child 1612 4c7893f943a8
equal deleted inserted replaced
1610:34bb3a9f1379 1611:5804b7d63ee8
     1 "
     1 "
     2  COPYRIGHT (c) 1997 by eXept Software AG 
     2  COPYRIGHT (c) 1997 by eXept Software AG 
     3 	      All Rights Reserved
     3               All Rights Reserved
     4 
     4 
     5  This software is furnished under a license and may be used
     5  This software is furnished under a license and may be used
     6  only in accordance with the terms of that license and with the
     6  only in accordance with the terms of that license and with the
     7  inclusion of the above copyright notice.   This software may not
     7  inclusion of the above copyright notice.   This software may not
     8  be provided or otherwise made available to, or used by, any
     8  be provided or otherwise made available to, or used by, any
    13 "
    13 "
    14 
    14 
    15 "{ Package: 'stx:libview2' }"
    15 "{ Package: 'stx:libview2' }"
    16 
    16 
    17 Object subclass:#MIMETypes
    17 Object subclass:#MIMETypes
    18 	instanceVariableNames:''
    18         instanceVariableNames:''
    19 	classVariableNames:'TypeToImageReaderClassMapping FileSuffixToTypeMapping
    19         classVariableNames:'TypeToImageReaderClassMapping FileSuffixToTypeMapping
    20 		FilenameToTypeMapping FileSuffixToImageReaderClassMapping
    20                 FilenameToTypeMapping FileSuffixToImageReaderClassMapping
    21 		CharSetToFontMapping LastSuffix LastType'
    21                 CharSetToFontMapping LastSuffix LastType'
    22 	poolDictionaries:''
    22         poolDictionaries:''
    23 	category:'System-Documentation'
    23         category:'System-Documentation'
    24 !
    24 !
    25 
    25 
    26 !MIMETypes class methodsFor:'documentation'!
    26 !MIMETypes class methodsFor:'documentation'!
    27 
    27 
    28 copyright
    28 copyright
    29 "
    29 "
    30  COPYRIGHT (c) 1997 by eXept Software AG 
    30  COPYRIGHT (c) 1997 by eXept Software AG 
    31 	      All Rights Reserved
    31               All Rights Reserved
    32 
    32 
    33  This software is furnished under a license and may be used
    33  This software is furnished under a license and may be used
    34  only in accordance with the terms of that license and with the
    34  only in accordance with the terms of that license and with the
    35  inclusion of the above copyright notice.   This software may not
    35  inclusion of the above copyright notice.   This software may not
    36  be provided or otherwise made available to, or used by, any
    36  be provided or otherwise made available to, or used by, any
   135 !
   135 !
   136 
   136 
   137 applicationTypeList
   137 applicationTypeList
   138     "applications"
   138     "applications"
   139 
   139 
   140     |types|                              
   140     |typeStrings|                            
   141 
   141 
   142     types := OrderedCollection new.
   142     typeStrings := OrderedCollection new.
   143     types addAll:self applicationProgLangTypeList.
   143     typeStrings addAll:self applicationProgLangTypeList.
   144     types addAll:self applicationTextTypeList.
   144     typeStrings addAll:self applicationTextTypeList.
   145     types addAll:self applicationComprAndArchiveTypeList.
   145     typeStrings addAll:self applicationComprAndArchiveTypeList.
   146     types addAll:self applicationMiscTypeList.
   146     ^ typeStrings
   147     ^ types
       
   148 !
   147 !
   149 
   148 
   150 audioTypeList
   149 audioTypeList
   151     "audio formats ..."
   150     "audio formats ..."
   152 
   151 
   600     FilenameToTypeMapping isNil ifTrue:[
   599     FilenameToTypeMapping isNil ifTrue:[
   601         FilenameToTypeMapping := Dictionary new
   600         FilenameToTypeMapping := Dictionary new
   602     ].
   601     ].
   603     FilenameToTypeMapping at:filename put:mimeType asLowercase
   602     FilenameToTypeMapping at:filename put:mimeType asLowercase
   604 
   603 
       
   604 !
       
   605 
       
   606 mimeTypeForFilenameByContents:filenameArg
       
   607     "given a filename, return the mime-type or nil, if unknown"
       
   608 
       
   609     |type filename|
       
   610 
       
   611     filename := filenameArg asFilename.
       
   612 
       
   613     ^ type
   605 !
   614 !
   606 
   615 
   607 mimeTypeForSuffix:suffix
   616 mimeTypeForSuffix:suffix
   608     "given a file suffix, return the mime-type"
   617     "given a file suffix, return the mime-type"
   609 
   618 
   649 !
   658 !
   650 
   659 
   651 mimeTypeForSuffixMapping
   660 mimeTypeForSuffixMapping
   652 
   661 
   653     ^ FileSuffixToTypeMapping
   662     ^ FileSuffixToTypeMapping
       
   663 !
       
   664 
       
   665 mimeTypeOfContents:filename
       
   666     "given a filename, scan the contents, return the mime-type or nil, if unknown"
       
   667 
       
   668     ^ filename mimeTypeOfContents.
   654 ! !
   669 ! !
   655 
   670 
   656 !MIMETypes class methodsFor:'documentation'!
   671 !MIMETypes class methodsFor:'documentation'!
   657 
   672 
   658 version
   673 version
   659     ^ '$Header: /cvs/stx/stx/libview2/MIMETypes.st,v 1.40 2002-09-11 15:42:31 stefan Exp $'
   674     ^ '$Header: /cvs/stx/stx/libview2/MIMETypes.st,v 1.41 2002-09-11 17:08:04 penk Exp $'
   660 ! !
   675 ! !
   661 MIMETypes initialize!
   676 MIMETypes initialize!