syntax for call to java library function with byte[] (reference) parameter?
Sockets, again.
Where I am:
I have cast & typecast to make my data look like uint8.
I have socket & getInputStream & BufferedInputStream.
I have seen references to using java.nio.channels.Channels.newChannel(stream) instead & socket inputstreams.
I can get individual bytes from any of these with byteReturn = thing.read(). They are the uint version of my data sent. So connectivity & such are ok.
.
Issue:
Clearly I’d like to move to the more efficient looking
thing.read(byte[]) forms.
methodsview(‘java.io.InputStream’) ==> read(byte[]) & read(byte[],int,int)
K>> methodsview(‘java.net.SocketInputStream’) ==> read(… the same
.
javaByteArray = javaArray(‘java.lang.Byte’,classStrLen);
count = configS.in.read(javaByteArray);
No method ‘read’ with matching signature …blah, blah
javaNioByteBuffer = java.nio.ByteBuffer.allocate(1024);
count = configS.channel.read(javaNioByteBuffer,0,classStrLen);
No method ‘read’ with matching signature found in class …blah, blah
I’ve combed the Matlab help (clearly inadequately) & not found it.
Can anyone enlighten me to the syntax for a call to a java library file with a reference parameter? ie make int = read(byte[]) work or other information that will make it viable?
Or how to get data out of a java.nio.ByteBuffer if it does arrive?
I’m guessing that I can just write a java function that returns the array & call it, but it feels as if it should be possible with just a few library calls.
Thanks in anticipation.
.
PS: pnet, yes I know: 2 days wasted trying to get SDK to install & failed, so no compiler. (Also pnet docs seemed so much more complicated than typecast & write() –> read(byte[]) …)Sockets, again.
Where I am:
I have cast & typecast to make my data look like uint8.
I have socket & getInputStream & BufferedInputStream.
I have seen references to using java.nio.channels.Channels.newChannel(stream) instead & socket inputstreams.
I can get individual bytes from any of these with byteReturn = thing.read(). They are the uint version of my data sent. So connectivity & such are ok.
.
Issue:
Clearly I’d like to move to the more efficient looking
thing.read(byte[]) forms.
methodsview(‘java.io.InputStream’) ==> read(byte[]) & read(byte[],int,int)
K>> methodsview(‘java.net.SocketInputStream’) ==> read(… the same
.
javaByteArray = javaArray(‘java.lang.Byte’,classStrLen);
count = configS.in.read(javaByteArray);
No method ‘read’ with matching signature …blah, blah
javaNioByteBuffer = java.nio.ByteBuffer.allocate(1024);
count = configS.channel.read(javaNioByteBuffer,0,classStrLen);
No method ‘read’ with matching signature found in class …blah, blah
I’ve combed the Matlab help (clearly inadequately) & not found it.
Can anyone enlighten me to the syntax for a call to a java library file with a reference parameter? ie make int = read(byte[]) work or other information that will make it viable?
Or how to get data out of a java.nio.ByteBuffer if it does arrive?
I’m guessing that I can just write a java function that returns the array & call it, but it feels as if it should be possible with just a few library calls.
Thanks in anticipation.
.
PS: pnet, yes I know: 2 days wasted trying to get SDK to install & failed, so no compiler. (Also pnet docs seemed so much more complicated than typecast & write() –> read(byte[]) …) Sockets, again.
Where I am:
I have cast & typecast to make my data look like uint8.
I have socket & getInputStream & BufferedInputStream.
I have seen references to using java.nio.channels.Channels.newChannel(stream) instead & socket inputstreams.
I can get individual bytes from any of these with byteReturn = thing.read(). They are the uint version of my data sent. So connectivity & such are ok.
.
Issue:
Clearly I’d like to move to the more efficient looking
thing.read(byte[]) forms.
methodsview(‘java.io.InputStream’) ==> read(byte[]) & read(byte[],int,int)
K>> methodsview(‘java.net.SocketInputStream’) ==> read(… the same
.
javaByteArray = javaArray(‘java.lang.Byte’,classStrLen);
count = configS.in.read(javaByteArray);
No method ‘read’ with matching signature …blah, blah
javaNioByteBuffer = java.nio.ByteBuffer.allocate(1024);
count = configS.channel.read(javaNioByteBuffer,0,classStrLen);
No method ‘read’ with matching signature found in class …blah, blah
I’ve combed the Matlab help (clearly inadequately) & not found it.
Can anyone enlighten me to the syntax for a call to a java library file with a reference parameter? ie make int = read(byte[]) work or other information that will make it viable?
Or how to get data out of a java.nio.ByteBuffer if it does arrive?
I’m guessing that I can just write a java function that returns the array & call it, but it feels as if it should be possible with just a few library calls.
Thanks in anticipation.
.
PS: pnet, yes I know: 2 days wasted trying to get SDK to install & failed, so no compiler. (Also pnet docs seemed so much more complicated than typecast & write() –> read(byte[]) …) matlab java sockets "java array reference parameter" java.socketinputstream.read MATLAB Answers — New Questions