PageRenderTime 25ms CodeModel.GetById 22ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/js/lib/Socket.IO-node/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/ByteString.as

http://github.com/onedayitwillmake/RealtimeMultiplayerNodeJs
ActionScript | 43 lines | 28 code | 7 blank | 8 comment | 0 complexity | a2b660f7970ef36aeb6a0c5a28302b05 MD5 | raw file
 1/**
 2 * ByteString
 3 * 
 4 * An ASN1 type for a ByteString, represented with a ByteArray
 5 * Copyright (c) 2007 Henri Torgemane
 6 * 
 7 * See LICENSE.txt for full license information.
 8 */
 9package com.hurlant.util.der
10{
11	import flash.utils.ByteArray;
12	import com.hurlant.util.Hex;
13
14	public class ByteString extends ByteArray implements IAsn1Type
15	{
16		private var type:uint;
17		private var len:uint;
18		
19		public function ByteString(type:uint = 0x04, length:uint = 0x00) {
20			this.type = type;
21			this.len = length;
22		}
23		
24		public function getLength():uint
25		{
26			return len;
27		}
28		
29		public function getType():uint
30		{
31			return type;
32		}
33		
34		public function toDER():ByteArray {
35			return DER.wrapDER(type, this);
36		}
37		
38		override public function toString():String {
39			return DER.indent+"ByteString["+type+"]["+len+"]["+Hex.fromArray(this)+"]";
40		}
41		
42	}
43}