Hi, I have this Matlab code that will read a certain binary file format:
%File
f=fopen(a.file,'r','b');
%Header
a.id=char(fread(f,5,'uint8'))';
if ~strcmp(a.id,['ATSF' char(0)]), %ATFS
a=[a.file ', unknown ats header:' a.id];
fclose(f);
return;
end
a.header=fread(f,1,'uint16');
a.channels=fread(f,1,'uint8');
a.blocks=fread(f,1,'uint32');
a.blocklength=fread(f,1,'uint16');
What I want is to do the same operation -- but in Java. It seems to me that data types uint8, uint16, and unit32 is more or less the same as the data types 'byte', 'short' and 'int' in Java. However, by using RandomAccessFile for data input I am only allowed to use 'byte' data type. Any ideas how to move on from here?