as3corelib 0.1.0 → 0.85.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. data/Gemfile +1 -4
  2. data/Gemfile.lock +7 -4
  3. data/README.textile +20 -10
  4. data/Rakefile +32 -2
  5. data/as3corelib.gemspec +13 -11
  6. data/lib/as3corelib.rb +10 -4
  7. data/lib/as3corelib/version.rb +4 -0
  8. metadata +31 -121
  9. data/build/build.properties +0 -48
  10. data/build/build.xml +0 -104
  11. data/examples/JSONExample/JSONExample.mxml +0 -73
  12. data/src/com/adobe/air/crypto/EncryptionKeyGenerator.as +0 -313
  13. data/src/com/adobe/air/filesystem/FileMonitor.as +0 -245
  14. data/src/com/adobe/air/filesystem/FileUtil.as +0 -63
  15. data/src/com/adobe/air/filesystem/VolumeMonitor.as +0 -184
  16. data/src/com/adobe/air/filesystem/events/FileMonitorEvent.as +0 -61
  17. data/src/com/adobe/air/logging/FileTarget.as +0 -95
  18. data/src/com/adobe/air/net/ResourceCache.as +0 -165
  19. data/src/com/adobe/air/net/events/ResourceCacheEvent.as +0 -70
  20. data/src/com/adobe/crypto/HMAC.as +0 -127
  21. data/src/com/adobe/crypto/MD5.as +0 -281
  22. data/src/com/adobe/crypto/MD5Stream.as +0 -402
  23. data/src/com/adobe/crypto/SHA1.as +0 -289
  24. data/src/com/adobe/crypto/SHA224.as +0 -257
  25. data/src/com/adobe/crypto/SHA256.as +0 -261
  26. data/src/com/adobe/crypto/WSSEUsernameToken.as +0 -114
  27. data/src/com/adobe/errors/IllegalStateError.as +0 -63
  28. data/src/com/adobe/fileformats/vcard/Address.as +0 -47
  29. data/src/com/adobe/fileformats/vcard/Email.as +0 -39
  30. data/src/com/adobe/fileformats/vcard/Phone.as +0 -39
  31. data/src/com/adobe/fileformats/vcard/VCard.as +0 -54
  32. data/src/com/adobe/fileformats/vcard/VCardParser.as +0 -246
  33. data/src/com/adobe/images/BitString.as +0 -39
  34. data/src/com/adobe/images/JPGEncoder.as +0 -648
  35. data/src/com/adobe/images/PNGEncoder.as +0 -141
  36. data/src/com/adobe/net/DynamicURLLoader.as +0 -55
  37. data/src/com/adobe/net/IURIResolver.as +0 -76
  38. data/src/com/adobe/net/MimeTypeMap.as +0 -200
  39. data/src/com/adobe/net/URI.as +0 -2466
  40. data/src/com/adobe/net/URIEncodingBitmap.as +0 -139
  41. data/src/com/adobe/net/proxies/RFC2817Socket.as +0 -198
  42. data/src/com/adobe/protocols/dict/Database.as +0 -66
  43. data/src/com/adobe/protocols/dict/Definition.as +0 -71
  44. data/src/com/adobe/protocols/dict/Dict.as +0 -360
  45. data/src/com/adobe/protocols/dict/DictionaryServer.as +0 -60
  46. data/src/com/adobe/protocols/dict/MatchStrategy.as +0 -66
  47. data/src/com/adobe/protocols/dict/Response.as +0 -71
  48. data/src/com/adobe/protocols/dict/events/ConnectedEvent.as +0 -53
  49. data/src/com/adobe/protocols/dict/events/DatabaseEvent.as +0 -67
  50. data/src/com/adobe/protocols/dict/events/DefinitionEvent.as +0 -70
  51. data/src/com/adobe/protocols/dict/events/DefinitionHeaderEvent.as +0 -69
  52. data/src/com/adobe/protocols/dict/events/DictionaryServerEvent.as +0 -69
  53. data/src/com/adobe/protocols/dict/events/DisconnectedEvent.as +0 -55
  54. data/src/com/adobe/protocols/dict/events/ErrorEvent.as +0 -80
  55. data/src/com/adobe/protocols/dict/events/MatchEvent.as +0 -67
  56. data/src/com/adobe/protocols/dict/events/MatchStrategiesEvent.as +0 -70
  57. data/src/com/adobe/protocols/dict/events/NoMatchEvent.as +0 -54
  58. data/src/com/adobe/protocols/dict/util/CompleteResponseEvent.as +0 -68
  59. data/src/com/adobe/protocols/dict/util/SocketHelper.as +0 -81
  60. data/src/com/adobe/serialization/json/JSON.as +0 -86
  61. data/src/com/adobe/serialization/json/JSONDecoder.as +0 -327
  62. data/src/com/adobe/serialization/json/JSONEncoder.as +0 -312
  63. data/src/com/adobe/serialization/json/JSONParseError.as +0 -87
  64. data/src/com/adobe/serialization/json/JSONToken.as +0 -104
  65. data/src/com/adobe/serialization/json/JSONTokenType.as +0 -69
  66. data/src/com/adobe/serialization/json/JSONTokenizer.as +0 -702
  67. data/src/com/adobe/utils/ArrayUtil.as +0 -187
  68. data/src/com/adobe/utils/DateUtil.as +0 -701
  69. data/src/com/adobe/utils/DictionaryUtil.as +0 -87
  70. data/src/com/adobe/utils/IntUtil.as +0 -99
  71. data/src/com/adobe/utils/NumberFormatter.as +0 -74
  72. data/src/com/adobe/utils/StringUtil.as +0 -239
  73. data/src/com/adobe/utils/XMLUtil.as +0 -168
  74. data/src/com/adobe/webapis/ServiceBase.as +0 -48
  75. data/src/com/adobe/webapis/URLLoaderBase.as +0 -108
  76. data/src/com/adobe/webapis/events/ServiceEvent.as +0 -82
  77. data/tests/src/CoreLibTestRunner-app.xml +0 -135
  78. data/tests/src/CoreLibTestRunner.as +0 -138
  79. data/tests/src/CoreLibTestRunner.mxml +0 -46
  80. data/tests/src/com/adobe/air/crypto/EncryptionKeyGeneratorTest.as +0 -176
  81. data/tests/src/com/adobe/air/filesystem/FileMonitorTest.as +0 -63
  82. data/tests/src/com/adobe/air/filesystem/VolumeMonitorTest.as +0 -57
  83. data/tests/src/com/adobe/air/filesystem/events/FileMonitorEventTest.as +0 -59
  84. data/tests/src/com/adobe/air/net/events/ResourceCacheEventTest.as +0 -72
  85. data/tests/src/com/adobe/crypto/HMACMD5Test.as +0 -134
  86. data/tests/src/com/adobe/crypto/HMACSHA1Test.as +0 -138
  87. data/tests/src/com/adobe/crypto/MD5Test.as +0 -82
  88. data/tests/src/com/adobe/crypto/SHA1Test.as +0 -151
  89. data/tests/src/com/adobe/crypto/SHA224Test.as +0 -104
  90. data/tests/src/com/adobe/crypto/SHA256Test.as +0 -116
  91. data/tests/src/com/adobe/crypto/WSSEUsernameTokenTest.as +0 -87
  92. data/tests/src/com/adobe/images/JPGEncoderTest.as +0 -54
  93. data/tests/src/com/adobe/images/PNGEncoderTest.as +0 -54
  94. data/tests/src/com/adobe/net/URITest.as +0 -589
  95. data/tests/src/com/adobe/protocols/events/ConnectedEventTest.as +0 -59
  96. data/tests/src/com/adobe/protocols/events/DatabaseEventTest.as +0 -62
  97. data/tests/src/com/adobe/protocols/events/DefinitionEventTest.as +0 -61
  98. data/tests/src/com/adobe/protocols/events/DefinitionHeaderEventTest.as +0 -61
  99. data/tests/src/com/adobe/protocols/events/DictionaryServerEventTest.as +0 -61
  100. data/tests/src/com/adobe/protocols/events/DisconnectedEventTest.as +0 -59
  101. data/tests/src/com/adobe/protocols/events/ErrorEventTest.as +0 -63
  102. data/tests/src/com/adobe/protocols/events/MatchEventTest.as +0 -61
  103. data/tests/src/com/adobe/protocols/events/MatchStrategiesEventTest.as +0 -61
  104. data/tests/src/com/adobe/protocols/events/NoMatchEventTest.as +0 -58
  105. data/tests/src/com/adobe/protocols/util/CompletedResponseEventTest.as +0 -60
  106. data/tests/src/com/adobe/serialization/json/JSONTest.as +0 -522
  107. data/tests/src/com/adobe/serialization/json/SimpleClass.as +0 -85
  108. data/tests/src/com/adobe/utils/ArrayUtilTest.as +0 -173
  109. data/tests/src/com/adobe/utils/DateUtilTest.as +0 -436
  110. data/tests/src/com/adobe/utils/DictionaryUtilTest.as +0 -93
  111. data/tests/src/com/adobe/utils/IntUtilTest.as +0 -73
  112. data/tests/src/com/adobe/utils/NumberFormatterTest.as +0 -70
  113. data/tests/src/com/adobe/utils/StringUtilTest.as +0 -304
  114. data/tests/src/com/adobe/utils/XMLUtilTest.as +0 -101
  115. data/tests/src/com/adobe/webapis/events/ServiceEventTest.as +0 -66
@@ -1,141 +0,0 @@
1
- /*
2
- Copyright (c) 2008, Adobe Systems Incorporated
3
- All rights reserved.
4
-
5
- Redistribution and use in source and binary forms, with or without
6
- modification, are permitted provided that the following conditions are
7
- met:
8
-
9
- * Redistributions of source code must retain the above copyright notice,
10
- this list of conditions and the following disclaimer.
11
-
12
- * Redistributions in binary form must reproduce the above copyright
13
- notice, this list of conditions and the following disclaimer in the
14
- documentation and/or other materials provided with the distribution.
15
-
16
- * Neither the name of Adobe Systems Incorporated nor the names of its
17
- contributors may be used to endorse or promote products derived from
18
- this software without specific prior written permission.
19
-
20
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
- IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
- */
32
- package com.adobe.images
33
- {
34
- import flash.geom.*;
35
- import flash.display.Bitmap;
36
- import flash.display.BitmapData;
37
- import flash.utils.ByteArray;
38
-
39
- /**
40
- * Class that converts BitmapData into a valid PNG
41
- */
42
- public class PNGEncoder
43
- {
44
- /**
45
- * Created a PNG image from the specified BitmapData
46
- *
47
- * @param image The BitmapData that will be converted into the PNG format.
48
- * @return a ByteArray representing the PNG encoded image data.
49
- * @langversion ActionScript 3.0
50
- * @playerversion Flash 9.0
51
- * @tiptext
52
- */
53
- public static function encode(img:BitmapData):ByteArray {
54
- // Create output byte array
55
- var png:ByteArray = new ByteArray();
56
- // Write PNG signature
57
- png.writeUnsignedInt(0x89504e47);
58
- png.writeUnsignedInt(0x0D0A1A0A);
59
- // Build IHDR chunk
60
- var IHDR:ByteArray = new ByteArray();
61
- IHDR.writeInt(img.width);
62
- IHDR.writeInt(img.height);
63
- IHDR.writeUnsignedInt(0x08060000); // 32bit RGBA
64
- IHDR.writeByte(0);
65
- writeChunk(png,0x49484452,IHDR);
66
- // Build IDAT chunk
67
- var IDAT:ByteArray= new ByteArray();
68
- for(var i:int=0;i < img.height;i++) {
69
- // no filter
70
- IDAT.writeByte(0);
71
- var p:uint;
72
- var j:int;
73
- if ( !img.transparent ) {
74
- for(j=0;j < img.width;j++) {
75
- p = img.getPixel(j,i);
76
- IDAT.writeUnsignedInt(
77
- uint(((p&0xFFFFFF) << 8)|0xFF));
78
- }
79
- } else {
80
- for(j=0;j < img.width;j++) {
81
- p = img.getPixel32(j,i);
82
- IDAT.writeUnsignedInt(
83
- uint(((p&0xFFFFFF) << 8)|
84
- (p>>>24)));
85
- }
86
- }
87
- }
88
- IDAT.compress();
89
- writeChunk(png,0x49444154,IDAT);
90
- // Build IEND chunk
91
- writeChunk(png,0x49454E44,null);
92
- // return PNG
93
- return png;
94
- }
95
-
96
- private static var crcTable:Array;
97
- private static var crcTableComputed:Boolean = false;
98
-
99
- private static function writeChunk(png:ByteArray,
100
- type:uint, data:ByteArray):void {
101
- if (!crcTableComputed) {
102
- crcTableComputed = true;
103
- crcTable = [];
104
- var c:uint;
105
- for (var n:uint = 0; n < 256; n++) {
106
- c = n;
107
- for (var k:uint = 0; k < 8; k++) {
108
- if (c & 1) {
109
- c = uint(uint(0xedb88320) ^
110
- uint(c >>> 1));
111
- } else {
112
- c = uint(c >>> 1);
113
- }
114
- }
115
- crcTable[n] = c;
116
- }
117
- }
118
- var len:uint = 0;
119
- if (data != null) {
120
- len = data.length;
121
- }
122
- png.writeUnsignedInt(len);
123
- var p:uint = png.position;
124
- png.writeUnsignedInt(type);
125
- if ( data != null ) {
126
- png.writeBytes(data);
127
- }
128
- var e:uint = png.position;
129
- png.position = p;
130
- c = 0xffffffff;
131
- for (var i:int = 0; i < (e-p); i++) {
132
- c = uint(crcTable[
133
- (c ^ png.readUnsignedByte()) &
134
- uint(0xff)] ^ uint(c >>> 8));
135
- }
136
- c = uint(c^uint(0xffffffff));
137
- png.position = e;
138
- png.writeUnsignedInt(c);
139
- }
140
- }
141
- }
@@ -1,55 +0,0 @@
1
- /*
2
- Copyright (c) 2008, Adobe Systems Incorporated
3
- All rights reserved.
4
-
5
- Redistribution and use in source and binary forms, with or without
6
- modification, are permitted provided that the following conditions are
7
- met:
8
-
9
- * Redistributions of source code must retain the above copyright notice,
10
- this list of conditions and the following disclaimer.
11
-
12
- * Redistributions in binary form must reproduce the above copyright
13
- notice, this list of conditions and the following disclaimer in the
14
- documentation and/or other materials provided with the distribution.
15
-
16
- * Neither the name of Adobe Systems Incorporated nor the names of its
17
- contributors may be used to endorse or promote products derived from
18
- this software without specific prior written permission.
19
-
20
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
- IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
- */
32
-
33
- package com.adobe.net
34
- {
35
- import flash.net.URLLoader;
36
-
37
- /**
38
- * Class that provides a dynamic implimentation of the URLLoader class.
39
- *
40
- * This class provides no API implimentations. However, since the class is
41
- * declared as dynamic, it can be used in place of URLLoader, and allow
42
- * you to dynamically attach properties to it (which URLLoader does not allow).
43
- *
44
- * @langversion ActionScript 3.0
45
- * @playerversion Flash 9.0
46
- * @tiptext
47
- */
48
- public dynamic class DynamicURLLoader extends URLLoader
49
- {
50
- public function DynamicURLLoader()
51
- {
52
- super();
53
- }
54
- }
55
- }
@@ -1,76 +0,0 @@
1
- /*
2
- Copyright (c) 2008, Adobe Systems Incorporated
3
- All rights reserved.
4
-
5
- Redistribution and use in source and binary forms, with or without
6
- modification, are permitted provided that the following conditions are
7
- met:
8
-
9
- * Redistributions of source code must retain the above copyright notice,
10
- this list of conditions and the following disclaimer.
11
-
12
- * Redistributions in binary form must reproduce the above copyright
13
- notice, this list of conditions and the following disclaimer in the
14
- documentation and/or other materials provided with the distribution.
15
-
16
- * Neither the name of Adobe Systems Incorporated nor the names of its
17
- contributors may be used to endorse or promote products derived from
18
- this software without specific prior written permission.
19
-
20
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
- IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
- */
32
-
33
- package com.adobe.net
34
- {
35
- /**
36
- * The URI class cannot know about DNS aliases, virtual hosts, or
37
- * symbolic links that may be involved. The application can provide
38
- * an implementation of this interface to resolve the URI before the
39
- * URI class makes any comparisons. For example, a web host has
40
- * two aliases:
41
- *
42
- * <p><code>
43
- * http://www.site.com/
44
- * http://www.site.net/
45
- * </code></p>
46
- *
47
- * <p>The application can provide an implementation that automatically
48
- * resolves site.net to site.com before URI compares two URI objects.
49
- * Only the application can know and understand the context in which
50
- * the URI's are being used.</p>
51
- *
52
- * <p>Use the URI.resolver accessor to assign a custom resolver to
53
- * the URI class. Any resolver specified is global to all instances
54
- * of URI.</p>
55
- *
56
- * <p>URI will call this before performing URI comparisons in the
57
- * URI.getRelation() and URI.getCommonParent() functions.
58
- *
59
- * @see URI.getRelation
60
- * @see URI.getCommonParent
61
- *
62
- * @langversion ActionScript 3.0
63
- * @playerversion Flash 9.0
64
- */
65
- public interface IURIResolver
66
- {
67
- /**
68
- * Implement this method to provide custom URI resolution for
69
- * your application.
70
- *
71
- * @langversion ActionScript 3.0
72
- * @playerversion Flash 9.0
73
- */
74
- function resolve(uri:URI) : URI;
75
- }
76
- }
@@ -1,200 +0,0 @@
1
- /*
2
- Copyright (c) 2008, Adobe Systems Incorporated
3
- All rights reserved.
4
-
5
- Redistribution and use in source and binary forms, with or without
6
- modification, are permitted provided that the following conditions are
7
- met:
8
-
9
- * Redistributions of source code must retain the above copyright notice,
10
- this list of conditions and the following disclaimer.
11
-
12
- * Redistributions in binary form must reproduce the above copyright
13
- notice, this list of conditions and the following disclaimer in the
14
- documentation and/or other materials provided with the distribution.
15
-
16
- * Neither the name of Adobe Systems Incorporated nor the names of its
17
- contributors may be used to endorse or promote products derived from
18
- this software without specific prior written permission.
19
-
20
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
- IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
- */
32
- package com.adobe.net
33
- {
34
- public class MimeTypeMap
35
- {
36
- private var types:Array =
37
- [["application/andrew-inset","ez"],
38
- ["application/atom+xml","atom"],
39
- ["application/mac-binhex40","hqx"],
40
- ["application/mac-compactpro","cpt"],
41
- ["application/mathml+xml","mathml"],
42
- ["application/msword","doc"],
43
- ["application/octet-stream","bin","dms","lha","lzh","exe","class","so","dll","dmg"],
44
- ["application/oda","oda"],
45
- ["application/ogg","ogg"],
46
- ["application/pdf","pdf"],
47
- ["application/postscript","ai","eps","ps"],
48
- ["application/rdf+xml","rdf"],
49
- ["application/smil","smi","smil"],
50
- ["application/srgs","gram"],
51
- ["application/srgs+xml","grxml"],
52
- ["application/vnd.adobe.apollo-application-installer-package+zip","air"],
53
- ["application/vnd.mif","mif"],
54
- ["application/vnd.mozilla.xul+xml","xul"],
55
- ["application/vnd.ms-excel","xls"],
56
- ["application/vnd.ms-powerpoint","ppt"],
57
- ["application/vnd.rn-realmedia","rm"],
58
- ["application/vnd.wap.wbxml","wbxml"],
59
- ["application/vnd.wap.wmlc","wmlc"],
60
- ["application/vnd.wap.wmlscriptc","wmlsc"],
61
- ["application/voicexml+xml","vxml"],
62
- ["application/x-bcpio","bcpio"],
63
- ["application/x-cdlink","vcd"],
64
- ["application/x-chess-pgn","pgn"],
65
- ["application/x-cpio","cpio"],
66
- ["application/x-csh","csh"],
67
- ["application/x-director","dcr","dir","dxr"],
68
- ["application/x-dvi","dvi"],
69
- ["application/x-futuresplash","spl"],
70
- ["application/x-gtar","gtar"],
71
- ["application/x-hdf","hdf"],
72
- ["application/x-javascript","js"],
73
- ["application/x-koan","skp","skd","skt","skm"],
74
- ["application/x-latex","latex"],
75
- ["application/x-netcdf","nc","cdf"],
76
- ["application/x-sh","sh"],
77
- ["application/x-shar","shar"],
78
- ["application/x-shockwave-flash","swf"],
79
- ["application/x-stuffit","sit"],
80
- ["application/x-sv4cpio","sv4cpio"],
81
- ["application/x-sv4crc","sv4crc"],
82
- ["application/x-tar","tar"],
83
- ["application/x-tcl","tcl"],
84
- ["application/x-tex","tex"],
85
- ["application/x-texinfo","texinfo","texi"],
86
- ["application/x-troff","t","tr","roff"],
87
- ["application/x-troff-man","man"],
88
- ["application/x-troff-me","me"],
89
- ["application/x-troff-ms","ms"],
90
- ["application/x-ustar","ustar"],
91
- ["application/x-wais-source","src"],
92
- ["application/xhtml+xml","xhtml","xht"],
93
- ["application/xml","xml","xsl"],
94
- ["application/xml-dtd","dtd"],
95
- ["application/xslt+xml","xslt"],
96
- ["application/zip","zip"],
97
- ["audio/basic","au","snd"],
98
- ["audio/midi","mid","midi","kar"],
99
- ["audio/mp4","f4a"],
100
- ["audio/mp4","f4b"],
101
- ["audio/mpeg","mp3","mpga","mp2"],
102
- ["audio/x-aiff","aif","aiff","aifc"],
103
- ["audio/x-mpegurl","m3u"],
104
- ["audio/x-pn-realaudio","ram","ra"],
105
- ["audio/x-wav","wav"],
106
- ["chemical/x-pdb","pdb"],
107
- ["chemical/x-xyz","xyz"],
108
- ["image/bmp","bmp"],
109
- ["image/cgm","cgm"],
110
- ["image/gif","gif"],
111
- ["image/ief","ief"],
112
- ["image/jpeg","jpg","jpeg","jpe"],
113
- ["image/png","png"],
114
- ["image/svg+xml","svg"],
115
- ["image/tiff","tiff","tif"],
116
- ["image/vnd.djvu","djvu","djv"],
117
- ["image/vnd.wap.wbmp","wbmp"],
118
- ["image/x-cmu-raster","ras"],
119
- ["image/x-icon","ico"],
120
- ["image/x-portable-anymap","pnm"],
121
- ["image/x-portable-bitmap","pbm"],
122
- ["image/x-portable-graymap","pgm"],
123
- ["image/x-portable-pixmap","ppm"],
124
- ["image/x-rgb","rgb"],
125
- ["image/x-xbitmap","xbm"],
126
- ["image/x-xpixmap","xpm"],
127
- ["image/x-xwindowdump","xwd"],
128
- ["model/iges","igs","iges"],
129
- ["model/mesh","msh","mesh","silo"],
130
- ["model/vrml","wrl","vrml"],
131
- ["text/calendar","ics","ifb"],
132
- ["text/css","css"],
133
- ["text/html","html","htm"],
134
- ["text/plain","txt","asc"],
135
- ["text/richtext","rtx"],
136
- ["text/rtf","rtf"],
137
- ["text/sgml","sgml","sgm"],
138
- ["text/tab-separated-values","tsv"],
139
- ["text/vnd.wap.wml","wml"],
140
- ["text/vnd.wap.wmlscript","wmls"],
141
- ["text/x-setext","etx"],
142
- ["video/mp4","f4v"],
143
- ["video/mp4","f4p"],
144
- ["video/mpeg","mpg","mpeg","mpe"],
145
- ["video/quicktime","mov","qt"],
146
- ["video/vnd.mpegurl","m4u","mxu"],
147
- ["video/x-flv","flv"],
148
- ["video/x-msvideo","avi"],
149
- ["video/x-sgi-movie","movie"],
150
- ["x-conference/x-cooltalk","ice"]];
151
-
152
- /**
153
- * Returns the mimetype for the given extension.
154
- */
155
- public function getMimeType(extension:String):String
156
- {
157
- extension = extension.toLocaleLowerCase();
158
- for each (var a:Array in types)
159
- {
160
- for each (var b:String in a)
161
- {
162
- if (b == extension)
163
- {
164
- return a[0];
165
- }
166
- }
167
- }
168
- return null;
169
- }
170
-
171
- /**
172
- * Returns the prefered extension for the given mimetype.
173
- */
174
- public function getExtension(mimetype:String):String
175
- {
176
- mimetype = mimetype.toLocaleLowerCase();
177
- for each (var a:Array in types)
178
- {
179
- if (a[0] == mimetype)
180
- {
181
- return a[1];
182
- }
183
- }
184
- return null;
185
- }
186
-
187
- /**
188
- * Adds a mimetype to the map. The order of the extensions matters. The most preferred should come first.
189
- */
190
- public function addMimeType(mimetype:String, extensions:Array):void
191
- {
192
- var newType:Array = [mimetype];
193
- for each (var a:String in extensions)
194
- {
195
- newType.push(a);
196
- }
197
- types.push(newType);
198
- }
199
- }
200
- }