Luís Tavares Luís Tavares - 1 month ago 7
Java Question

Sending a String via Serial COMM

I'm developing a system with Gemalto BG5ST (a java modem).
I need to send a string sent via http GET request to the Serial Port.
This string is stored, but the problem is that I need the data to be int or byte in order to write in the Outputstream.

Is there anyway to go around this?

OutputStream outStream = null;
String strCOM = "comm:COM0;blocking=off;baudrate=115200";//autocts=off;autorts=off
CommConnection commConn = (CommConnection)Connector.open(strCOM)
inStream = commConn.openInputStream();
outStream = commConn.openOutputStream();


Working with IDE 1.3 due to modem restrictions.
Thanks!

Answer

str.getBytes() - 1.1 version, used default charset

str.getBytes("UTF-8") - 1.1 version

Comments