as3corelib 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +5 -0
- data/Gemfile.lock +28 -0
- data/README.textile +79 -0
- data/Rakefile +3 -0
- data/as3corelib.gemspec +23 -0
- data/build/build.properties +48 -0
- data/build/build.xml +104 -0
- data/examples/JSONExample/JSONExample.mxml +73 -0
- data/lib/as3corelib.rb +15 -0
- data/src/com/adobe/air/crypto/EncryptionKeyGenerator.as +313 -0
- data/src/com/adobe/air/filesystem/FileMonitor.as +245 -0
- data/src/com/adobe/air/filesystem/FileUtil.as +63 -0
- data/src/com/adobe/air/filesystem/VolumeMonitor.as +184 -0
- data/src/com/adobe/air/filesystem/events/FileMonitorEvent.as +61 -0
- data/src/com/adobe/air/logging/FileTarget.as +95 -0
- data/src/com/adobe/air/net/ResourceCache.as +165 -0
- data/src/com/adobe/air/net/events/ResourceCacheEvent.as +70 -0
- data/src/com/adobe/crypto/HMAC.as +127 -0
- data/src/com/adobe/crypto/MD5.as +281 -0
- data/src/com/adobe/crypto/MD5Stream.as +402 -0
- data/src/com/adobe/crypto/SHA1.as +289 -0
- data/src/com/adobe/crypto/SHA224.as +257 -0
- data/src/com/adobe/crypto/SHA256.as +261 -0
- data/src/com/adobe/crypto/WSSEUsernameToken.as +114 -0
- data/src/com/adobe/errors/IllegalStateError.as +63 -0
- data/src/com/adobe/fileformats/vcard/Address.as +47 -0
- data/src/com/adobe/fileformats/vcard/Email.as +39 -0
- data/src/com/adobe/fileformats/vcard/Phone.as +39 -0
- data/src/com/adobe/fileformats/vcard/VCard.as +54 -0
- data/src/com/adobe/fileformats/vcard/VCardParser.as +246 -0
- data/src/com/adobe/images/BitString.as +39 -0
- data/src/com/adobe/images/JPGEncoder.as +648 -0
- data/src/com/adobe/images/PNGEncoder.as +141 -0
- data/src/com/adobe/net/DynamicURLLoader.as +55 -0
- data/src/com/adobe/net/IURIResolver.as +76 -0
- data/src/com/adobe/net/MimeTypeMap.as +200 -0
- data/src/com/adobe/net/URI.as +2466 -0
- data/src/com/adobe/net/URIEncodingBitmap.as +139 -0
- data/src/com/adobe/net/proxies/RFC2817Socket.as +198 -0
- data/src/com/adobe/protocols/dict/Database.as +66 -0
- data/src/com/adobe/protocols/dict/Definition.as +71 -0
- data/src/com/adobe/protocols/dict/Dict.as +360 -0
- data/src/com/adobe/protocols/dict/DictionaryServer.as +60 -0
- data/src/com/adobe/protocols/dict/MatchStrategy.as +66 -0
- data/src/com/adobe/protocols/dict/Response.as +71 -0
- data/src/com/adobe/protocols/dict/events/ConnectedEvent.as +53 -0
- data/src/com/adobe/protocols/dict/events/DatabaseEvent.as +67 -0
- data/src/com/adobe/protocols/dict/events/DefinitionEvent.as +70 -0
- data/src/com/adobe/protocols/dict/events/DefinitionHeaderEvent.as +69 -0
- data/src/com/adobe/protocols/dict/events/DictionaryServerEvent.as +69 -0
- data/src/com/adobe/protocols/dict/events/DisconnectedEvent.as +55 -0
- data/src/com/adobe/protocols/dict/events/ErrorEvent.as +80 -0
- data/src/com/adobe/protocols/dict/events/MatchEvent.as +67 -0
- data/src/com/adobe/protocols/dict/events/MatchStrategiesEvent.as +70 -0
- data/src/com/adobe/protocols/dict/events/NoMatchEvent.as +54 -0
- data/src/com/adobe/protocols/dict/util/CompleteResponseEvent.as +68 -0
- data/src/com/adobe/protocols/dict/util/SocketHelper.as +81 -0
- data/src/com/adobe/serialization/json/JSON.as +86 -0
- data/src/com/adobe/serialization/json/JSONDecoder.as +327 -0
- data/src/com/adobe/serialization/json/JSONEncoder.as +312 -0
- data/src/com/adobe/serialization/json/JSONParseError.as +87 -0
- data/src/com/adobe/serialization/json/JSONToken.as +104 -0
- data/src/com/adobe/serialization/json/JSONTokenType.as +69 -0
- data/src/com/adobe/serialization/json/JSONTokenizer.as +702 -0
- data/src/com/adobe/utils/ArrayUtil.as +187 -0
- data/src/com/adobe/utils/DateUtil.as +701 -0
- data/src/com/adobe/utils/DictionaryUtil.as +87 -0
- data/src/com/adobe/utils/IntUtil.as +99 -0
- data/src/com/adobe/utils/NumberFormatter.as +74 -0
- data/src/com/adobe/utils/StringUtil.as +239 -0
- data/src/com/adobe/utils/XMLUtil.as +168 -0
- data/src/com/adobe/webapis/ServiceBase.as +48 -0
- data/src/com/adobe/webapis/URLLoaderBase.as +108 -0
- data/src/com/adobe/webapis/events/ServiceEvent.as +82 -0
- data/tests/src/CoreLibTestRunner-app.xml +135 -0
- data/tests/src/CoreLibTestRunner.as +138 -0
- data/tests/src/CoreLibTestRunner.mxml +46 -0
- data/tests/src/com/adobe/air/crypto/EncryptionKeyGeneratorTest.as +176 -0
- data/tests/src/com/adobe/air/filesystem/FileMonitorTest.as +63 -0
- data/tests/src/com/adobe/air/filesystem/VolumeMonitorTest.as +57 -0
- data/tests/src/com/adobe/air/filesystem/events/FileMonitorEventTest.as +59 -0
- data/tests/src/com/adobe/air/net/events/ResourceCacheEventTest.as +72 -0
- data/tests/src/com/adobe/crypto/HMACMD5Test.as +134 -0
- data/tests/src/com/adobe/crypto/HMACSHA1Test.as +138 -0
- data/tests/src/com/adobe/crypto/MD5Test.as +82 -0
- data/tests/src/com/adobe/crypto/SHA1Test.as +151 -0
- data/tests/src/com/adobe/crypto/SHA224Test.as +104 -0
- data/tests/src/com/adobe/crypto/SHA256Test.as +116 -0
- data/tests/src/com/adobe/crypto/WSSEUsernameTokenTest.as +87 -0
- data/tests/src/com/adobe/images/JPGEncoderTest.as +54 -0
- data/tests/src/com/adobe/images/PNGEncoderTest.as +54 -0
- data/tests/src/com/adobe/net/URITest.as +589 -0
- data/tests/src/com/adobe/protocols/events/ConnectedEventTest.as +59 -0
- data/tests/src/com/adobe/protocols/events/DatabaseEventTest.as +62 -0
- data/tests/src/com/adobe/protocols/events/DefinitionEventTest.as +61 -0
- data/tests/src/com/adobe/protocols/events/DefinitionHeaderEventTest.as +61 -0
- data/tests/src/com/adobe/protocols/events/DictionaryServerEventTest.as +61 -0
- data/tests/src/com/adobe/protocols/events/DisconnectedEventTest.as +59 -0
- data/tests/src/com/adobe/protocols/events/ErrorEventTest.as +63 -0
- data/tests/src/com/adobe/protocols/events/MatchEventTest.as +61 -0
- data/tests/src/com/adobe/protocols/events/MatchStrategiesEventTest.as +61 -0
- data/tests/src/com/adobe/protocols/events/NoMatchEventTest.as +58 -0
- data/tests/src/com/adobe/protocols/util/CompletedResponseEventTest.as +60 -0
- data/tests/src/com/adobe/serialization/json/JSONTest.as +522 -0
- data/tests/src/com/adobe/serialization/json/SimpleClass.as +85 -0
- data/tests/src/com/adobe/utils/ArrayUtilTest.as +173 -0
- data/tests/src/com/adobe/utils/DateUtilTest.as +436 -0
- data/tests/src/com/adobe/utils/DictionaryUtilTest.as +93 -0
- data/tests/src/com/adobe/utils/IntUtilTest.as +73 -0
- data/tests/src/com/adobe/utils/NumberFormatterTest.as +70 -0
- data/tests/src/com/adobe/utils/StringUtilTest.as +304 -0
- data/tests/src/com/adobe/utils/XMLUtilTest.as +101 -0
- data/tests/src/com/adobe/webapis/events/ServiceEventTest.as +66 -0
- metadata +196 -0
@@ -0,0 +1,70 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (c) 2009, 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.protocols.dict.events
|
34
|
+
{
|
35
|
+
import com.adobe.protocols.dict.Definition;
|
36
|
+
|
37
|
+
import flash.events.Event;
|
38
|
+
|
39
|
+
|
40
|
+
public class DefinitionEvent extends Event
|
41
|
+
{
|
42
|
+
public static const DEFINITION:String = "definition";
|
43
|
+
|
44
|
+
private var _definition:Definition;
|
45
|
+
|
46
|
+
public function DefinitionEvent(type:String, bubbles:Boolean = false,
|
47
|
+
cancelable:Boolean = false)
|
48
|
+
{
|
49
|
+
super(type, bubbles, cancelable);
|
50
|
+
}
|
51
|
+
|
52
|
+
public function set definition(definition:Definition):void
|
53
|
+
{
|
54
|
+
this._definition = definition;
|
55
|
+
}
|
56
|
+
|
57
|
+
public function get definition():Definition
|
58
|
+
{
|
59
|
+
return this._definition;
|
60
|
+
}
|
61
|
+
|
62
|
+
public override function clone():Event
|
63
|
+
{
|
64
|
+
var out:DefinitionEvent = new DefinitionEvent(type, bubbles, cancelable);
|
65
|
+
out.definition = _definition;
|
66
|
+
|
67
|
+
return out;
|
68
|
+
}
|
69
|
+
}
|
70
|
+
}
|
@@ -0,0 +1,69 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (c) 2009, 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.protocols.dict.events
|
34
|
+
{
|
35
|
+
import flash.events.Event;
|
36
|
+
|
37
|
+
public class DefinitionHeaderEvent extends Event
|
38
|
+
{
|
39
|
+
public static const DEFINITION_HEADER:String = "definitionHeader";
|
40
|
+
|
41
|
+
private var _definitionCount:uint;
|
42
|
+
|
43
|
+
public function DefinitionHeaderEvent(type:String, bubbles:Boolean = false,
|
44
|
+
cancelable:Boolean = false)
|
45
|
+
{
|
46
|
+
super(type, bubbles, cancelable);
|
47
|
+
}
|
48
|
+
|
49
|
+
public function set definitionCount(definitionCount:uint):void
|
50
|
+
{
|
51
|
+
this._definitionCount = definitionCount;
|
52
|
+
}
|
53
|
+
|
54
|
+
public function get definitionCount():uint
|
55
|
+
{
|
56
|
+
return this._definitionCount;
|
57
|
+
}
|
58
|
+
|
59
|
+
public override function clone():Event
|
60
|
+
{
|
61
|
+
var out:DefinitionHeaderEvent = new DefinitionHeaderEvent(type,
|
62
|
+
bubbles, cancelable);
|
63
|
+
|
64
|
+
out.definitionCount = _definitionCount;
|
65
|
+
|
66
|
+
return out;
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
@@ -0,0 +1,69 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (c) 2009, 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.protocols.dict.events
|
34
|
+
{
|
35
|
+
import flash.events.Event;
|
36
|
+
|
37
|
+
public class DictionaryServerEvent extends Event
|
38
|
+
{
|
39
|
+
public static const SERVERS:String = "servers";
|
40
|
+
|
41
|
+
private var _servers:Array;
|
42
|
+
|
43
|
+
public function DictionaryServerEvent(type:String, bubbles:Boolean = false,
|
44
|
+
cancelable:Boolean = false)
|
45
|
+
{
|
46
|
+
super(type, bubbles, cancelable);
|
47
|
+
}
|
48
|
+
|
49
|
+
public function set servers(servers:Array):void
|
50
|
+
{
|
51
|
+
this._servers = servers;
|
52
|
+
}
|
53
|
+
|
54
|
+
public function get servers():Array
|
55
|
+
{
|
56
|
+
return this._servers;
|
57
|
+
}
|
58
|
+
|
59
|
+
public override function clone():Event
|
60
|
+
{
|
61
|
+
var out:DictionaryServerEvent = new DictionaryServerEvent(type,
|
62
|
+
bubbles, cancelable);
|
63
|
+
|
64
|
+
out.servers = _servers;
|
65
|
+
|
66
|
+
return out;
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
@@ -0,0 +1,55 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (c) 2009, 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.protocols.dict.events
|
34
|
+
{
|
35
|
+
import flash.events.Event;
|
36
|
+
|
37
|
+
public class DisconnectedEvent extends Event
|
38
|
+
{
|
39
|
+
public static const DISCONNECTED:String = "disconnected";
|
40
|
+
|
41
|
+
public function DisconnectedEvent(type:String, bubbles:Boolean = false,
|
42
|
+
cancelable:Boolean = false)
|
43
|
+
{
|
44
|
+
super(type, bubbles, cancelable);
|
45
|
+
}
|
46
|
+
|
47
|
+
public override function clone():Event
|
48
|
+
{
|
49
|
+
var out:DisconnectedEvent = new DisconnectedEvent(type, bubbles, cancelable);
|
50
|
+
|
51
|
+
return out;
|
52
|
+
}
|
53
|
+
|
54
|
+
}
|
55
|
+
}
|
@@ -0,0 +1,80 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (c) 2009, 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.protocols.dict.events
|
34
|
+
{
|
35
|
+
import flash.events.Event;
|
36
|
+
|
37
|
+
public class ErrorEvent extends Event
|
38
|
+
{
|
39
|
+
public static const ERROR:String = "error";
|
40
|
+
|
41
|
+
private var _code:uint;
|
42
|
+
private var _message:String;
|
43
|
+
|
44
|
+
public function ErrorEvent(type:String, bubbles:Boolean = false,
|
45
|
+
cancelable:Boolean = false)
|
46
|
+
{
|
47
|
+
super(type, bubbles, cancelable);
|
48
|
+
}
|
49
|
+
|
50
|
+
public function set code(code:uint):void
|
51
|
+
{
|
52
|
+
this._code = code;
|
53
|
+
}
|
54
|
+
|
55
|
+
public function set message(message:String):void
|
56
|
+
{
|
57
|
+
this._message = message;
|
58
|
+
}
|
59
|
+
|
60
|
+
public function get code():uint
|
61
|
+
{
|
62
|
+
return this._code;
|
63
|
+
}
|
64
|
+
|
65
|
+
public function get message():String
|
66
|
+
{
|
67
|
+
return this._message;
|
68
|
+
}
|
69
|
+
|
70
|
+
public override function clone():Event
|
71
|
+
{
|
72
|
+
var out:ErrorEvent = new ErrorEvent(type, bubbles, cancelable);
|
73
|
+
|
74
|
+
out.message = _message;
|
75
|
+
out.code = _code;
|
76
|
+
|
77
|
+
return out;
|
78
|
+
}
|
79
|
+
}
|
80
|
+
}
|
@@ -0,0 +1,67 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (c) 2009, 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.protocols.dict.events
|
34
|
+
{
|
35
|
+
import flash.events.Event;
|
36
|
+
|
37
|
+
public class MatchEvent extends Event
|
38
|
+
{
|
39
|
+
private var _matches:Array;
|
40
|
+
|
41
|
+
public static const MATCH:String = "match";
|
42
|
+
|
43
|
+
public function MatchEvent(type:String, bubbles:Boolean = false,
|
44
|
+
cancelable:Boolean = false)
|
45
|
+
{
|
46
|
+
super(type, bubbles, cancelable);
|
47
|
+
}
|
48
|
+
|
49
|
+
public function set matches(matches:Array):void
|
50
|
+
{
|
51
|
+
this._matches = matches;
|
52
|
+
}
|
53
|
+
|
54
|
+
public function get matches():Array
|
55
|
+
{
|
56
|
+
return this._matches;
|
57
|
+
}
|
58
|
+
|
59
|
+
public override function clone():Event
|
60
|
+
{
|
61
|
+
var out:MatchEvent = new MatchEvent(type, bubbles, cancelable);
|
62
|
+
out.matches = _matches;
|
63
|
+
|
64
|
+
return out;
|
65
|
+
}
|
66
|
+
}
|
67
|
+
}
|
@@ -0,0 +1,70 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (c) 2009, 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.protocols.dict.events
|
34
|
+
{
|
35
|
+
import flash.events.Event;
|
36
|
+
|
37
|
+
public class MatchStrategiesEvent
|
38
|
+
extends Event
|
39
|
+
{
|
40
|
+
private var _strategies:Array;
|
41
|
+
|
42
|
+
public static const MATCH_STRATEGIES:String = "matchStrategies";
|
43
|
+
|
44
|
+
public function MatchStrategiesEvent(type:String, bubbles:Boolean = false,
|
45
|
+
cancelable:Boolean = false)
|
46
|
+
{
|
47
|
+
super(type, bubbles, cancelable);
|
48
|
+
}
|
49
|
+
|
50
|
+
public function set strategies(strategies:Array):void
|
51
|
+
{
|
52
|
+
this._strategies = strategies;
|
53
|
+
}
|
54
|
+
|
55
|
+
public function get strategies():Array
|
56
|
+
{
|
57
|
+
return this._strategies;
|
58
|
+
}
|
59
|
+
|
60
|
+
public override function clone():Event
|
61
|
+
{
|
62
|
+
var out:MatchStrategiesEvent = new MatchStrategiesEvent(type,
|
63
|
+
bubbles, cancelable);
|
64
|
+
|
65
|
+
out.strategies = _strategies;
|
66
|
+
|
67
|
+
return out;
|
68
|
+
}
|
69
|
+
}
|
70
|
+
}
|
@@ -0,0 +1,54 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (c) 2009, 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.protocols.dict.events
|
34
|
+
{
|
35
|
+
import flash.events.Event;
|
36
|
+
|
37
|
+
public class NoMatchEvent extends Event
|
38
|
+
{
|
39
|
+
public static const NO_MATCH:String = "noMatch";
|
40
|
+
|
41
|
+
public function NoMatchEvent(type:String, bubbles:Boolean = false,
|
42
|
+
cancelable:Boolean = false)
|
43
|
+
{
|
44
|
+
super(type, bubbles, cancelable);
|
45
|
+
}
|
46
|
+
|
47
|
+
public override function clone():Event
|
48
|
+
{
|
49
|
+
var out:NoMatchEvent = new NoMatchEvent(type, bubbles, cancelable);
|
50
|
+
|
51
|
+
return out;
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
@@ -0,0 +1,68 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (c) 2009, 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.protocols.dict.util
|
34
|
+
{
|
35
|
+
import flash.events.Event;
|
36
|
+
|
37
|
+
public class CompleteResponseEvent extends Event
|
38
|
+
{
|
39
|
+
private var _response:String;
|
40
|
+
|
41
|
+
public static const COMPLETE_RESPONSE:String = "completeResponse"
|
42
|
+
|
43
|
+
public function CompleteResponseEvent(type:String, bubbles:Boolean = false,
|
44
|
+
cancelable:Boolean = false)
|
45
|
+
{
|
46
|
+
super(type, bubbles, cancelable);
|
47
|
+
}
|
48
|
+
|
49
|
+
public function set response(response:String):void
|
50
|
+
{
|
51
|
+
this._response = response;
|
52
|
+
}
|
53
|
+
|
54
|
+
public function get response():String
|
55
|
+
{
|
56
|
+
return this._response;
|
57
|
+
}
|
58
|
+
|
59
|
+
public override function clone():Event
|
60
|
+
{
|
61
|
+
var out:CompleteResponseEvent = new CompleteResponseEvent(type,
|
62
|
+
bubbles, cancelable);
|
63
|
+
out.response = _response;
|
64
|
+
|
65
|
+
return out;
|
66
|
+
}
|
67
|
+
}
|
68
|
+
}
|
@@ -0,0 +1,81 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (c) 2009, 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.protocols.dict.util
|
34
|
+
{
|
35
|
+
import com.adobe.net.proxies.RFC2817Socket;
|
36
|
+
import flash.events.ProgressEvent;
|
37
|
+
|
38
|
+
public class SocketHelper
|
39
|
+
extends RFC2817Socket
|
40
|
+
{
|
41
|
+
private var terminator:String = "\r\n.\r\n";
|
42
|
+
private var buffer:String;
|
43
|
+
public static var COMPLETE_RESPONSE:String = "completeResponse";
|
44
|
+
|
45
|
+
public function SocketHelper()
|
46
|
+
{
|
47
|
+
super();
|
48
|
+
buffer = new String();
|
49
|
+
addEventListener(ProgressEvent.SOCKET_DATA, incomingData);
|
50
|
+
}
|
51
|
+
|
52
|
+
private function incomingData(event:ProgressEvent):void
|
53
|
+
{
|
54
|
+
buffer += readUTFBytes(bytesAvailable);
|
55
|
+
buffer = buffer.replace(/250[^\r\n]+\r\n/, ""); // Get rid of all 250s. Don't need them.
|
56
|
+
var codeStr:String = buffer.substring(0, 3);
|
57
|
+
if (!isNaN(parseInt(codeStr)))
|
58
|
+
{
|
59
|
+
var code:uint = uint(codeStr);
|
60
|
+
if (code == 150 || code >= 200)
|
61
|
+
{
|
62
|
+
buffer = buffer.replace("\r\n", this.terminator);
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
while (buffer.indexOf(this.terminator) != -1)
|
67
|
+
{
|
68
|
+
var chunk:String = buffer.substring(0, buffer.indexOf(this.terminator));
|
69
|
+
buffer = buffer.substring(chunk.length + this.terminator.length, buffer.length);
|
70
|
+
throwResponseEvent(chunk);
|
71
|
+
}
|
72
|
+
}
|
73
|
+
|
74
|
+
private function throwResponseEvent(response:String):void
|
75
|
+
{
|
76
|
+
var responseEvent:CompleteResponseEvent = new CompleteResponseEvent(CompleteResponseEvent.COMPLETE_RESPONSE);
|
77
|
+
responseEvent.response = response;
|
78
|
+
dispatchEvent(responseEvent);
|
79
|
+
}
|
80
|
+
}
|
81
|
+
}
|