Skip to content

Commit c797bb2

Browse files
committed
integrating zmat, for zlib/gzip data compression
1 parent 70551fe commit c797bb2

File tree

6 files changed

+28
-0
lines changed

6 files changed

+28
-0
lines changed

base64decode.m

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@
1717
if(nargin==0)
1818
error('you must provide at least 1 input');
1919
end
20+
if(exist('OCTAVE_VERSION','builtin'))
21+
len=rem(numel(input),8)
22+
if(len)
23+
input=[input(:)', repmat(sprintf('\0'),1,(8-len))];
24+
end
25+
output = base64_decode(input);
26+
return;
27+
end
2028
error(javachk('jvm'));
2129
if ischar(input), input = uint8(input); end
2230

base64encode.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
if(nargin==0)
1818
error('you must provide at least 1 input');
1919
end
20+
if(exist('OCTAVE_VERSION','builtin'))
21+
output = base64_encode(uint8(input));
22+
return;
23+
end
2024
error(javachk('jvm'));
2125
if ischar(input), input = uint8(input); end
2226

gzipdecode.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
if(nargin==0)
1818
error('you must provide at least 1 input');
1919
end
20+
if(exist('zmat')==3)
21+
output=zmat(uint8(input),0,'gzip');
22+
return;
23+
end
2024
error(javachk('jvm'));
2125
if ischar(input)
2226
warning('gzipdecode:inputTypeMismatch', ...

gzipencode.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
if(nargin==0)
1919
error('you must provide at least 1 input');
2020
end
21+
if(exist('zmat')==3)
22+
output=zmat(uint8(input),1,'gzip');
23+
return;
24+
end
2125
error(javachk('jvm'));
2226
if ischar(input), input = uint8(input); end
2327
if ~isa(input, 'int8') && ~isa(input, 'uint8')

zlibdecode.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
if(nargin==0)
1818
error('you must provide at least 1 input');
1919
end
20+
if(exist('zmat')==3)
21+
output=zmat(uint8(input),0,'zlib');
22+
return;
23+
end
2024
error(javachk('jvm'));
2125
if ischar(input)
2226
warning('zlibdecode:inputTypeMismatch', ...

zlibencode.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
if(nargin==0)
2020
error('you must provide at least 1 input');
2121
end
22+
if(exist('zmat')==3)
23+
output=zmat(input,1,'zlib');
24+
return;
25+
end
2226
error(javachk('jvm'));
2327
if ischar(input), input = uint8(input); end
2428
if ~isa(input, 'int8') && ~isa(input, 'uint8')

0 commit comments

Comments
 (0)