-
Notifications
You must be signed in to change notification settings - Fork 0
HexDump
uupaa edited this page Jan 21, 2016
·
11 revisions
Entity of HexDump module is located in the global.WebModule.HexDump.
If you want publish to global namespace.
HexDump モジュールの実体は、global.WebModule.HexDump にあります。
global 名前空間に直接公開する事もできます。その場合は global.HexDump でもアクセス可能になります。
HexDump(source:TypedArray|Array, options:Object = null):void は source を console.log に ダンプします。
- source の型(1byte, 2byte, 4byte)によって、ダンプ幅も変化します
- source が Array の場合は 1byte の数値としてダンプします
- source が 1byte型(Unit8Array)の場合は、右側に ASCII コードダンプと適用した STYLE の一覧も表示します
以下のオプションを指定できます
options | |
---|---|
options.title:String = "" | タイトルの指定 |
options.begin:UINT32 = 0 | ダンプ範囲の先頭を指定 |
options.end:UINT32 = source.length | ダンプ範囲の末尾を指定 |
options.rule:Object = null | スタイル適用ルールの指定 |
source には、Uin32Array, Uint16Array, Uint8Array と 数値要素からなる Array を指定できます。
HexDump( new Uint32Array([12354, 12356, 12358, 12360, 12362]) );
> ADDR 0 1 2 3
> ------ -------- -------- -------- --------
> 000000 00003042 00003044 00003046 00003048
> 000004 0000304a
HexDump( new Uint16Array([12354, 12356, 12358, 12360, 12362]) );
> ADDR 0 1 2 3 4 5 6 7
> ------ ---- ---- ---- ---- ---- ---- ---- ----
> 000000 3042 3044 3046 3048 304a
HexDump( new Uint8Array([66, 68, 70, 72, 74]) );
> ADDR 0 1 2 3 4 5 6 7 8 9 A B C D E F
> ------ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 000000 42 44 46 48 4a BDFHJ
HexDump( [66, 68, 70, 72, 74] );
> ADDR 0 1 2 3 4 5 6 7 8 9 A B C D E F
> ------ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 000000 42 44 46 48 4a BDFHJ
options.begin と options.end でダンプする範囲を指定できます。
var source = new Uint8Array( mp4boxBinary );
var begin = 0x00;
var end = 0x20;
HexDump(source, { begin: begin, end: end });
> ADDR 0 1 2 3 4 5 6 7 8 9 A B C D E F
> ------ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 000000 00 00 00 20 66 74 79 70 69 73 6f 6d 00 00 02 00 ・・・ ftypisom・・・・
> 000010 69 73 6f 6d 69 73 6f 32 61 76 63 31 6d 70 34 31 isomiso2avc1mp41
options.rule を指定すると、values と一致する連続した数値や begin 〜 end で指定した区間にスタイルを適用できます。
values と begin, end は混在が可能です。
- rule
-
bold
を指定するとfont-weight:bold
が適用されます -
style
を指定すると CSSStyleText が適用されます - 複数のスタイルを重ね掛けできます
-
var source = new Uint8Array( byteStream );
HexDump(source, {
title: "MP4Muxer_mux",
rule: {
"first_start_code(00 00 00 01)": { values: [0x00, 0x00, 0x00, 0x01], begin: 0, end: 5, bold: true, style: "color:blue" },
"start_code(00 00 01)": { values: [0x00, 0x00, 0x01], begin: 4, bold: true, style: "color:green" },
"access unit delimiter": { values: [0x09, 0xF0], bold: true, style: "color:red" },
}
});