change ArrayCompression keywords to ArrayZip to be short · NeuroJSON/jsonlab@3eb6d56 · GitHub
Skip to content

Commit 3eb6d56

Browse files
committed
change ArrayCompression keywords to ArrayZip to be short
1 parent e5f2ffb commit 3eb6d56

7 files changed

Lines changed: 43 additions & 43 deletions

File tree

‎README.rst‎

Lines changed: 6 additions & 6 deletions

‎README.txt‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -281,11 +281,11 @@ JSON. The detailed help info for the four functions can be found below:
281281
compress a long string, one must convert
282282
it to uint8 or int8 array first. The compressed
283283
array uses three extra fields
284-
"_ArrayCompressionMethod_": the opt.Compression value.
285-
"_ArrayCompressionSize_": a 1D interger array to
284+
"_ArrayZipType_": the opt.Compression value.
285+
"_ArrayZipSize_": a 1D interger array to
286286
store the pre-compressed (but post-processed)
287287
array dimensions, and
288-
"_ArrayCompressedData_": the "base64" encoded
288+
"_ArrayZipData_": the "base64" encoded
289289
compressed binary array data.
290290
opt.CompressArraySize [100|int]: only to compress an array if the total
291291
element count is larger than this number.
@@ -424,11 +424,11 @@ JSON. The detailed help info for the four functions can be found below:
424424
compress a long string, one must convert
425425
it to uint8 or int8 array first. The compressed
426426
array uses three extra fields
427-
"_ArrayCompressionMethod_": the opt.Compression value.
428-
"_ArrayCompressionSize_": a 1D interger array to
427+
"_ArrayZipType_": the opt.Compression value.
428+
"_ArrayZipSize_": a 1D interger array to
429429
store the pre-compressed (but post-processed)
430430
array dimensions, and
431-
"_ArrayCompressedData_": the binary stream of
431+
"_ArrayZipData_": the binary stream of
432432
the compressed binary array data WITHOUT
433433
'base64' encoding
434434
opt.CompressArraySize [100|int]: only to compress an array if the total

‎examples/jsonlab_basictest.matlab‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,9 +1276,9 @@ ans =
12761276
{
12771277
"_ArrayType_": "double",
12781278
"_ArraySize_": [20,10],
1279-
"_ArrayCompressionSize_": [1,200],
1280-
"_ArrayCompressionMethod_": "zlib",
1281-
"_ArrayCompressedData_": "eJxjYACBD/YMNAGj5o6aO2ruKBgFgwtQL10DAMHODQY=
1279+
"_ArrayZipSize_": [1,200],
1280+
"_ArrayZipType_": "zlib",
1281+
"_ArrayZipData_": "eJxjYACBD/YMNAGj5o6aO2ruKBgFgwtQL10DAMHODQY=
12821282
"
12831283
}
12841284

‎examples/jsonlab_ubjson_basictest.matlab‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ json2data =
792792
ans =
793793

794794
{U_ArrayType_SUdoubleU_ArraySize_[$U#U
795-
U_ArrayCompressionSize_[$U#UÈU_ArrayCompressionMethod_SUzlibU_ArrayCompressedData_[$U#U xœc` ö4£æŽš;jî(ƒP/] ÁÎ}
795+
U_ArrayZipSize_[$U#UÈU_ArrayZipType_SUzlibU_ArrayZipData_[$U#U xœc` ö4£æŽš;jî(ƒP/] ÁÎ}
796796

797797

798798
json2data =

‎jdatadecode.m‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
% specification. The JData keywords are
1414
% "_ArrayType_", "_ArraySize_", "_ArrayData_"
1515
% "_ArrayIsSparse_", "_ArrayIsComplex_",
16-
% "_ArrayCompressionMethod_", "_ArrayCompressionSize",
17-
% "_ArrayCompressedData_"
16+
% "_ArrayZipType_", "_ArrayZipSize",
17+
% "_ArrayZipData_"
1818
% opt: (optional) a list of 'Param',value pairs for additional options
1919
% The supported options include
2020
% 'Recursive', if set to 1, will apply the conversion to
2121
% every child; 0 to disable
22-
% 'Base64'. if set to 1, _ArrayCompressedData_ is assumed to
22+
% 'Base64'. if set to 1, _ArrayZipData_ is assumed to
2323
% be encoded with base64 format and need to be
2424
% decoded first. This is needed for JSON but not
2525
% UBJSON data
@@ -64,20 +64,20 @@
6464
end
6565
end
6666

67-
if(~isempty(strmatch(N_('_ArrayType_'),fn)) && (~isempty(strmatch(N_('_ArrayData_'),fn)) || ~isempty(strmatch(N_('_ArrayCompressedData_'),fn))))
67+
if(~isempty(strmatch(N_('_ArrayType_'),fn)) && (~isempty(strmatch(N_('_ArrayData_'),fn)) || ~isempty(strmatch(N_('_ArrayZipData_'),fn))))
6868
newdata=cell(len,1);
6969
for j=1:len
70-
if(~isempty(strmatch(N_('_ArrayCompressionSize_'),fn)) && ~isempty(strmatch(N_('_ArrayCompressedData_'),fn)))
70+
if(~isempty(strmatch(N_('_ArrayZipSize_'),fn)) && ~isempty(strmatch(N_('_ArrayZipData_'),fn)))
7171
zipmethod='zip';
72-
if(~isempty(strmatch(N_('_ArrayCompressionMethod_'),fn)))
73-
zipmethod=data(j).(N_('_ArrayCompressionMethod_'));
72+
if(~isempty(strmatch(N_('_ArrayZipType_'),fn)))
73+
zipmethod=data(j).(N_('_ArrayZipType_'));
7474
end
7575
if(~isempty(strmatch(zipmethod,{'zlib','gzip','lzma','lzip'})))
7676
decompfun=str2func([zipmethod 'decode']);
7777
if(needbase64)
78-
ndata=reshape(typecast(decompfun(base64decode(data(j).(N_('_ArrayCompressedData_')))),data(j).(N_('_ArrayType_'))),data(j).(N_('_ArrayCompressionSize_')));
78+
ndata=reshape(typecast(decompfun(base64decode(data(j).(N_('_ArrayZipData_')))),data(j).(N_('_ArrayType_'))),data(j).(N_('_ArrayZipSize_')));
7979
else
80-
ndata=reshape(typecast(decompfun(data(j).(N_('_ArrayCompressedData_'))),data(j).(N_('_ArrayType_'))),data(j).(N_('_ArrayCompressionSize_')));
80+
ndata=reshape(typecast(decompfun(data(j).(N_('_ArrayZipData_'))),data(j).(N_('_ArrayType_'))),data(j).(N_('_ArrayZipSize_')));
8181
end
8282
else
8383
error('compression method is not supported');

‎savejson.m‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@
7575
% compress a long string, one must convert
7676
% it to uint8 or int8 array first. The compressed
7777
% array uses three extra fields
78-
% "_ArrayCompressionMethod_": the opt.Compression value.
79-
% "_ArrayCompressionSize_": a 1D interger array to
78+
% "_ArrayZipType_": the opt.Compression value.
79+
% "_ArrayZipSize_": a 1D interger array to
8080
% store the pre-compressed (but post-processed)
8181
% array dimensions, and
82-
% "_ArrayCompressedData_": the "base64" encoded
82+
% "_ArrayZipData_": the "base64" encoded
8383
% compressed binary array data.
8484
% opt.CompressArraySize [100|int]: only to compress an array if the total
8585
% element count is larger than this number.
@@ -534,10 +534,10 @@
534534
% General case, store row and column indices.
535535
fulldata=[ix,iy,data];
536536
end
537-
txt=sprintf(dataformat,txt,padding0,'"_ArrayCompressionSize_": ',regexprep(mat2str(size(fulldata)),'\s+',','), sep);
538-
txt=sprintf(dataformat,txt,padding0,'"_ArrayCompressionMethod_": "',dozip, ['"' sep]);
537+
txt=sprintf(dataformat,txt,padding0,'"_ArrayZipSize_": ',regexprep(mat2str(size(fulldata)),'\s+',','), sep);
538+
txt=sprintf(dataformat,txt,padding0,'"_ArrayZipType_": "',dozip, ['"' sep]);
539539
compfun=str2func([dozip 'encode']);
540-
txt=sprintf(dataformat,txt,padding0,'"_ArrayCompressedData_": "',base64encode(compfun(typecast(fulldata(:),'uint8'))),['"' nl]);
540+
txt=sprintf(dataformat,txt,padding0,'"_ArrayZipData_": "',base64encode(compfun(typecast(fulldata(:),'uint8'))),['"' nl]);
541541
else
542542
if(size(item,1)==1)
543543
% Row vector, store only column indices.
@@ -566,10 +566,10 @@
566566
txt=sprintf(dataformat,txt,padding0,'"_ArrayIsComplex_": ','true', sep);
567567
fulldata=[real(item(:)) imag(item(:))]';
568568
end
569-
txt=sprintf(dataformat,txt,padding0,'"_ArrayCompressionSize_": ',regexprep(mat2str(size(fulldata)),'\s+',','), sep);
570-
txt=sprintf(dataformat,txt,padding0,'"_ArrayCompressionMethod_": "',dozip, ['"' sep]);
569+
txt=sprintf(dataformat,txt,padding0,'"_ArrayZipSize_": ',regexprep(mat2str(size(fulldata)),'\s+',','), sep);
570+
txt=sprintf(dataformat,txt,padding0,'"_ArrayZipType_": "',dozip, ['"' sep]);
571571
compfun=str2func([dozip 'encode']);
572-
txt=sprintf(dataformat,txt,padding0,'"_ArrayCompressedData_": "',base64encode(compfun(typecast(fulldata(:),'uint8'))),['"' nl]);
572+
txt=sprintf(dataformat,txt,padding0,'"_ArrayZipData_": "',base64encode(compfun(typecast(fulldata(:),'uint8'))),['"' nl]);
573573
else
574574
if(isreal(item))
575575
txt=sprintf(dataformat,txt,padding0,'"_ArrayData_": ',...

‎saveubjson.m‎

Lines changed: 9 additions & 9 deletions

0 commit comments

Comments
 (0)