Hi Patrick,
As I can understand, you are trying to implement the “DataInputReader” class into MATLAB. Also, you are interested in understanding how to retrieve Java byte arrays in MATLAB.
Please refer to the following MathWorks documentation for more information on handling data in Java:
- Handle Data Returned from Java Methods: https://www.mathworks.com/help/matlab/matlab_external/handling-data-returned-from-java-methods.html
You can import Java datatypes into MATLAB and use them along with your MATLAB arrays, here’s an example:
import java.lang.*
sampleArray = javaArray('java.lang.Byte', 1, 19);
for i = 1:numel(sampleArray(1, :))
sampleArray(1, i) = Byte(randi(100, 1));
end
The above MATLAB script creates a sample Java ByteArray (in MATLAB Java ByteArrays use int8 datatype).
Please refer to the following MathWorks documentation for more information on classes and error handling in MATLAB:
- Creating user-defined classes in MATLAB: https://www.mathworks.com/help/matlab/matlab_oop/user-defined-classes.html
- Execute statements and catch resulting errors: https://www.mathworks.com/help/matlab/ref/try.html
I hope this helps, thanks!